JS: getPrototypeOf vs __proto__
By Xah Lee. Date: . Last updated: .
What is the difference between getPrototypeOf vs .__proto__ Property
__proto__ may fail when a object in its parent chain has a string key "__proto__".
__proto__ fails when object does not have a parent.
__proto__ is not supported in Deno, TypeScript.
__proto__ is not standard JavaScript, but is mentioned in appendix of JavaScript spec.
__proto__ works via inheritance over prototype object Object.prototype.__proto__
- Reflect.getPrototypeOf and Reflect.setPrototypeOf always work, and are in JavaScript spec.
JavaScript. Get Set Prototype