如何知道对象是否是代理?

时间:2017-06-22 09:42:53

标签: javascript

如何知道对象是否是代理?



function A(n){this.n=n;};

let a = new A(1);
let p = new Proxy(a,{});

console.log('p.constructor == Proxy; // ', p.constructor == Proxy);
console.log('p.constructor == A; // ', p.constructor == A);

console.log('Proxy.prototype: ', Proxy.prototype); // null

console.log('Object.getPrototypeOf(p) == Object.getPrototypeOf(a); // ', 
	Object.getPrototypeOf(p) == Object.getPrototypeOf(a));

console.log('\n');




0 个答案:

没有答案