const log = [];
const handler = {
set(target, key, value) {
log.push(`set:${key}=${value}`);
target[key] = value;
return true;
},
get(target, key) {
log.push(`get:${key}`);
return target[key];
}
};
const state = new Proxy({}, handler);
state.count = 0;
state.count = state.count + 1;
state.count = state.count + 1;
console.log(log.join(" | "));
Post #3253
2.57K
CHALLENGE
- ❤ 3
- 👍 2
- 🔥 1