找到数组原型
Object.create()方法创建一个新对象,使用现有的对象来提供新创建的对象的__proto__。
const originalProto = Array.prototype;
const arrayProto = Object.create(Array.prototype)
覆盖那些能够修改数组的更新方法,使其可以通知更新
['push', 'pop', 'shift', 'unshift'].forEach(method => {<br> arrayProto[method] = function() {<br> // 执行原来的方法<br> originalProto[method].apply(this, arguments);<br> // <br> };<br>})