JavaScript Array length Property- Tutorialpath

JavaScript – Array length Property

We can find the length or size of any JavaScript array length by using its length property.


Syntax:

To access the elements of the array we can use this length property to loop through. Please note that first element of an array starts from 0 so array_name[1] is the second element of the array where as array_name[0] is the first element of the array. Same way the last element of the array is the total size of the array minus one.

Return Value

Returns the length of the array.

Example:

Output:

 

Leave a Reply

Your email address will not be published.