标签:return this 数组 res code tab pre function 响应
var a = [1,1,4] var arrayProto = Array.prototype; var arrayMethods = Object.create(arrayProto); Object.defineProperty(a, ‘push‘, { value: function(){ var arguments$1 = arguments; // avoid leaking arguments: // http://jsperf.com/closure-with-arguments var i = arguments.length; var args = new Array(i); while (i--) { args[i] = arguments$1[i]; } var original = arrayProto[‘push‘]; var result = original.apply(this, args); console.log("触发响应,比如更新视图"); return result; }, enumerable: true, writable: true, configurable: true });
标签:return this 数组 res code tab pre function 响应
原文地址:http://www.cnblogs.com/adaBlog/p/6957051.html