SOURCE

console 命令行工具 X clear

                    
>
console
var obj = { year: 2}
Object.preventExtensions(obj);

var proxy = new Proxy(obj, {
    has: function(target, prop) {
        console.log('called: ' + prop);
        return false;
    }
})
console.log('a' in proxy); // 不存在的属性没有问题
console.log('year' in proxy); // Uncaught TypeError: 'has' on proxy: trap returned falsish for property 'year' but the proxy target is not extensible
<! DOCTYPE html>
<html>
    <body>
        target对象不可拓展,则已经存在的属性不能被代理隐藏
    </body>
</html>