Compare Revisions

Array.length

Revision 477583:

Revision 477583 by LouisLazaris on

Revision 477585:

Revision 477585 by LouisLazaris on

Title:
Array.length
Array.length
Slug:
Web/JavaScript/Reference/Global_Objects/Array/length
Web/JavaScript/Reference/Global_Objects/Array/length
Tags:
"Array"
"Array"
Content:

Revision 477583
Revision 477585
t53      You can set the <code>length</code> property to truncate ant53      You can set the <code>length</code> property to truncate an
> array at any time. When you extend an array by changing its <cod> array at any time. When you extend an array by changing its <cod
>e>length</code> property, the additional elements are set to <cod>e>length</code> property, the additional elements are set to <cod
>e>undefined</code>; for example, if you set <code>length</code> t>e>undefined</code>; for example, if you set <code>length</code> t
>o 5 when it is currently 2, the array will contain 2 defined elem>o 5 when it is currently 2, the array will contain 2 defined elem
>ents along with 3 additional elements with values of <code>undefi>ents along with 3 additional elements with values of <code>undefi
>ned</code>.&nbsp; Also see <a href="/en-US/docs/Web/JavaScript/Re>ned</code>. &nbsp;<span style="line-height: 1.572;">Thus, the&nbs
>ference/Global_Objects/Array#Relationship_between_length_and_nume>p;</span><code style="font-size: 14px;">length</code><span style=
>rical_properties" title="Relationship between length and numerica>"line-height: 1.572;">&nbsp;property says nothing about the numbe
>l properties">Relationship between length and numerical propertie>r of defined values in the array.&nbsp;</span><span style="line-h
>s</a>. The <code>length</code> property says nothing about the nu>eight: 1.572;">See also&nbsp;</span><a href="/en-US/docs/Web/Java
>mber of values in the array.>Script/Reference/Global_Objects/Array#Relationship_between_length
 >_and_numerical_properties" style="line-height: 1.572;" title="Rel
 >ationship between length and numerical properties">Relationship b
 >etween length and numerical properties</a><span style="line-heigh
 >t: 1.572;">.</span>

Back to History