Created
January 24, 2017 18:04
-
-
Save mosfet1kg/02c92c5e16542d243525e4d77c9ece59 to your computer and use it in GitHub Desktop.
stringbuilder.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function aaa(){ | |
var str=''; | |
return { | |
aaaa: function(l){ | |
str+=l; | |
//console.log(str); | |
return this; | |
}, | |
bbbb: function(){ | |
console.log(str); | |
} | |
} | |
} | |
var t1 = new aaa(); | |
t1.aaaa('hello'); | |
t1.aaaa('world'); | |
t1.aaaa('nice').aaaa('meet').aaaa('you'); | |
t1.bbbb(); | |
var t2 = new aaa(); | |
t2.aaaa('hello1'); | |
t2.aaaa('world1'); | |
t2.aaaa('nice1').aaaa('meet1').aaaa('you1'); | |
t2.bbbb(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
gbchoiui-MacBook-Pro:aws gbchoi$ node mytest.js
helloworldnicemeetyou
hello1world1nice1meet1you1