개발하자/자바스크립트
StringBuffer
i구야
2015. 2. 24. 15:35
<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>