Johnson Cheng

Results 1 comments of Johnson Cheng

其实通过下标给数组设置,是可以触发set方法的,但是像push、shift、unshift等操作数组并不会触发get方法,以下是测试代码 ` function myDefineProperty(data, key, value) { Object.defineProperty(data, key, { configurable: true, get: () => { console.log("get", "key:", key); console.log("get", "value:", value); return value; }, set: (newValue) => { console.log("set",...