Last active
October 8, 2016 13:25
-
-
Save sAbakumoff/1ef72aad9f997fb10f14aedd48dddf24 to your computer and use it in GitHub Desktop.
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
// way#1 - adding the element to an arbitrary position | |
var a1 = new Array(); | |
a1[1000 * 1000 * 1000] = 'a'; | |
a1.length; // 1000000001 | |
// way#2 - setting the length at creation time | |
var a2 = new Array(1000*1000*1000 + 1); | |
a2[0] = 'a'; | |
a2.length; // 1000000001 | |
//way#3 - setting length property: | |
var a3 = new Array(); | |
a3[0] = 'a'; | |
a3.length = 1000*1000*1000 + 1; | |
a3.length; // 1000000001 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment