Object.defineProperty(Object.prototype, '__proto__', {
get() {
let _thisObj = Object (this);
return Object.getPrototypeOf(_thisObj);
},
set(proto) {
if (this === undefined || this === null) {
throw new TypeError();
}
if (!isObject(this)) {
return undefined;
}
if (!isObject(proto)) {
return undefined;
}
let status = Reflect.setPrototypeOf(this, proto);
if(!status) {
throw new TypeError();
}
},
});
function isObject(value) {
return Object(value) === value;
}
参考《ES6标准入门》(第3版) P166