解决方案 »

  1.   

    你应该有返回值.
    stringBuffer.prototype.toString=function (){ return this._strings_.join(" ");};
    function stringBuffer()
    {
    this._strings_=new Array();
    }
    stringBuffer.prototype.append=function (str){this._strings_.push(str);};
    stringBuffer.prototype.toString=function (){ return this._strings_.join(" ");};

    var string1=new stringBuffer();
    string1.append("Hello");
    string1.append("World");
    document.write(string1.toString());//Hello World
      

  2.   

    function stringBuffer()
    {
    this._strings_=new Array();
    }
    stringBuffer.prototype.append=function (str){this._strings_.push(str);};
    stringBuffer.prototype.toString=function (){return this._strings_.join(" ");};

    var string1=new stringBuffer();
    string1.append("Hello");
    string1.append("World");
    //console.log(string1.toString());
    string2 = string1.toString();
    document.write(typeof(string1._strings_));
    document.write(string2);
      

  3.   

    你typeof的是一个数组  object没错吧
    +1
    toString 需要返回字符串
      

  4.   

    输出“hello,world"是因为调用了数组的toString()方法