We have the function
function Buffer(initValue) {
this.append(initValue);
}
Buffer.prototype = {
items: [],
append: function(str) {
this.items[this.items.length] = str instanceof Buffer ? str.toString() : str;
return this;
},
toString: function() {
return this.items.join("");
}
};
console.log(new Buffer("one").append(new Buffer("two")).toString());
but suddenly it logs "onetwoonetwo" - beyond all expectations... Why?