Open chap95 opened 3 years ago
const target = { message1: "hello", message2: "everyone", };
const handler2 = { get: function (target, prop, receiver) { return "world"; }, };
const proxy2 = new Proxy(target, handler2); console.log(proxy2.message1); console.log(proxy2.message1);
3. 다음 코드의 실행 결과를 쓰시오. ```js const target = { message1: "hello", message2: "everyone", }; const handler3 = { get: function (target, prop, receiver) { if (prop === "message2") { return "world"; } return Reflect.get(...arguments); }, }; const proxy3 = new Proxy(target, handler3); console.log(proxy3.message1); console.log(proxy3.message2);
6주차 문제
자바스크립트 Proxy
const handler2 = { get: function (target, prop, receiver) { return "world"; }, };
const proxy2 = new Proxy(target, handler2); console.log(proxy2.message1); console.log(proxy2.message1);