Created
June 2, 2012 20:20
-
-
Save npow/2859811 to your computer and use it in GitHub Desktop.
Attribute getter
This file contains 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
Object.defineProperty( | |
Object.prototype, | |
"2", | |
{ | |
get: function() { | |
/* some crazy side-effect */ | |
} | |
} | |
); | |
new Float64Array(1)[2] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Working_with_Objects#Defining_getters_and_setters