주체가 어떤 객체의 상태 변화를 관찰하다가 상태 변화가 있을 때마다 메소드 등을 이용해 옵저버 목록에 있는 옵저버들에게 변화를 알려주는 디자인 패턴!
const handler = {
get: function(target, name){
return name === 'name' ? `${target.a} ${target.b}` : target[name]
}
}
const p = new Proxy({a : "first", b : "second"}, handler)
console.log(p.name) // first second
new Proxy로 선언한 객체의 a와 b라는 속성에 특정 문자열을 담아서 handler에 name이라는 속성에 접근 할 때는 a , b를 합쳐서 문자열을 만들어라. 라는 명령을 준것임.