var targetArr = [];
var targetProxy = new Proxy(targetArr, {
set: function (target, key, value) {
console.log(`${key} set to ${value}`);
target[key] = value;
return true;
},
get: function(target, property) {
console.log(`${JSON.stringify(target)} and ${property}`);
// property is index in this case
return target[property];
},
});
targetProxy.push('hi');
console.log(targetArr)