<html>
<body>
<script>
function StringBuffer(){
this.buffer=[];
this.append=function(str){
this.buffer.push(str);
}
this.toString=function(){
return this.buffer.join("");
}
}
var buffer=new StringBuffer();
buffer.append("aa");
buffer.append("bb");
buffer.append("cc");
document.write(buffer); // aabbcc
</script>
</body>
</html>
'개발하자 > 자바스크립트' 카테고리의 다른 글
Car.prototype.getSpeed (0) | 2015.02.24 |
---|---|
prototype (0) | 2015.02.24 |
sort (0) | 2015.02.24 |
buffer.join(""); (0) | 2015.02.24 |
join (0) | 2015.02.24 |