首页  >  文章  >  web前端  >  js 字符连接对象

js 字符连接对象

巴扎黑
巴扎黑原创
2016-12-06 11:39:061095浏览

function StringBuffer(){ 
     this.str = []; 


StringBuffer.prototype = { 
    append:function(str){ 
        this.str.push(str); 
        return this; 
   }, 
   toString:function(){ 
        return  this.str.join(''); 
   }, 
   clear:function(){ 
       this.str.length = 0; 
       return this; 
  } 
}


声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn