Skip to content

Instantly share code, notes, and snippets.

@sAbakumoff
Last active October 9, 2016 02:25
Show Gist options
  • Save sAbakumoff/efc8cf038f3be01e47f1dfa7f400f352 to your computer and use it in GitHub Desktop.
Save sAbakumoff/efc8cf038f3be01e47f1dfa7f400f352 to your computer and use it in GitHub Desktop.
var a = new Array(1000*1000*1000 + 1);
a[0] = 'a'; a[110] = 'b'; a[900] = 'c';
Object.getOwnPropertyNames(a); // ["0", "110", "900", "length"]
// in operator automatically converts the left part to string
110 in a; // true
15 in a; // false
a[15] = 'd';
15 in a; // true
Object.getOwnPropertyNames(a); // ["0", "15", 110", "900", "length"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment