Created
May 9, 2014 21:30
-
-
Save hikari-no-yume/b06da1119526f499141b to your computer and use it in GitHub Desktop.
How to mess with JavaScript programmers
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 TotallyNotArray = Object.create(Array.prototype); | |
TotallyNotArray.constructor = Array; | |
var EvilArray = function () { | |
return Object.create(TotallyNotArray); | |
}; | |
// Now do x = EvilArray(); in Chrome's dev console | |
// It'll show up like an array, and all operations will work... | |
// But there's no magic .length property! >:D |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment