87,910
社区成员
发帖
与我相关
我的任务
分享
Array.prototype._push = Array.prototype.push;
Array.prototype.push = function(v){
this._push(v);
if(typeof this.pushListener == 'function') this.pushListener.call(this,v)
}
var a = [], b = [];
a.pushListener = function(v){
alert('在数组a中添加新元素'+v);
}
a.push(1);
b.pushListener = function(v){
alert('在数组b中添加新元素'+v);
}
b.push(1);