我有以下PROG在java腳本繼承中堆棧流!
Object.prototype.inherit = function(baseConstructor) {
this.prototype = (baseConstructor.prototype);
this.prototype.constructor = this;
};
Object.prototype.method = function(name, func) {
this.prototype[name] = func;
};
function StrangeArray(){}
StrangeArray.inherit(Array);
StrangeArray.method("push", function(value) {
Array.prototype.push.call(this, value);
});
var strange = new StrangeArray();
strange.push(4);
alert(strange);
和伊倫當我得到疊翻轉過來流?任何想法爲什麼?
非常感謝你 – ravi 2009-08-31 18:29:30