JavaScript syntax: Difference between revisions

Content deleted Content added
m invert mvar-link placement for upcoming tstyles
Array: Added information about maximum array type length in JS.
Line 483:
</syntaxhighlight>
 
[[Array data structure|Arrays]] are implemented so that only the defined elements use memory; they are "[[sparse array]]s". Setting {{code|lang=javascript|code=myArray[10] = 'someThing'}} and {{code|lang=javascript|code=myArray[57] = 'somethingOther'}} only uses space for these two elements, just like any other object. The <tt>length</tt> of the array will still be reported as 58. The maximum length of an array is 4,294,967,295 which corresponds to 32-bit binary number (11111111111111111111111111111111)<sub>2</sub>.
 
One can use the object declaration literal to create objects that behave much like associative arrays in other languages: