Created
June 17, 2014 20:29
-
-
Save raymondfeng/1637493e0fe12c1eade8 to your computer and use it in GitHub Desktop.
prototype properties
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function X() { | |
} | |
Object.defineProperty(X.prototype, '__data', | |
{enumerable: false, configurable: true, writable: true, value: {x: 0}}); | |
var x1 = new X(); | |
console.log(Object.keys(x1)); | |
console.log(x1.__data); | |
x1.__data = {x: 1}; | |
console.log(Object.keys(x1)); | |
var x2 = new X(); | |
console.log(x2.__data); | |
x2.__data = {x: 2}; | |
console.log(Object.keys(x1)); | |
console.log(x1); | |
console.log(Object.keys(x2)); | |
console.log(x2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment