Proxy व्यवहार करता है <__proto__>:
_ = new Proxy({}, {
get:z=>console.log('a'),
getPrototypeOf:z=>console.log('b'),
});
_.__proto__/*a*/
— और <getPrototypeOf> रूप
var parentObject = {"parentKey" : "parentValue"};
var childObject = {"childKey" : "childValue"};
childObject.__proto__ = parentObject;
console.log(childObject.parentKey); // parentValue
Object.getPrototypeOf(childObject) = {"parentKey" : "newValue"};
// ReferenceError: Invalid left-hand side in assignment
एक और अंतर यह है कि वे कैसे एक नाम संघर्ष की संभावना नहीं मामले को संभालने है एक getPrototypeOf:
_ = new Proxy({}, {
get:z=>console.log('a'),
getPrototypeOf:z=>console.log('b'),
});
Object.getPrototypeOf(_)/*b*/
नाम संघर्ष को इंगित करने के लिए धन्यवाद, जानना अच्छा है। – simonzack