Created
March 26, 2013 07:04
-
-
Save guipn/5243621 to your computer and use it in GitHub Desktop.
Demonstration of Object.defineProperty on arrays. The algorithm followed is specified in 15.2.3.6 and 15.4.5.1.
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
var a = []; | |
Object.defineProperty(a, '0', { | |
get: function () { | |
console.log("Here it is."); | |
} | |
}); | |
a.push(10); | |
void a[0]; // logs 'Here it is.'. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment