js Proxy
2021-01-18 08:12
标签:target console value zhang nav name efi code fine js Proxy 标签:target console value zhang nav name efi code fine 原文地址:https://www.cnblogs.com/c-x-a/p/13352522.htmlw={"navigator":"hehe"}
var handler = {
get(target, key,receiver){
console.log("target",target,receiver);
return Reflect.has(target, key)
? Reflect.get(target, key)
: undefined
},
set(target, key, value){
return Reflect.set(target, key, value);
}
}
w["name"]="zhangsan"
w = new Proxy(w, handler);
console.log(w.name)