Home  >  Article  >  Web Front-end  >  js character connection object

js character connection object

巴扎黑
巴扎黑Original
2016-12-06 11:39:061095browse

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; 
  } 
}


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn