Сообщение от registrant
|
o={a: 1}
a=Object.create(o)
alert(a.a)
alert(eval((a.toSource()).a))
alert(eval(a.toSource()).a)
alert(eval(a.toSource())===a)
|
(function () {
var toSource = Object.prototype.toSource;
Object.defineProperty(Object.prototype, 'toSource', {
writable: true,
configurable: true,
enumerable: false,
value: function () {
var clone = {};
for (var key in this) {
clone[key] = this[key];
}
return toSource.call(clone);
}
});
})();
var a = {a: 1};
var b = {
__proto__: a,
c: 1,
};
alert(eval(b.toSource()).a);