Latest web development tutorials

JavaScript length property

Array Object Reference Manual JavaScript array of objects

Examples

Returns the number of array:

fruits.length;

The result could be

4

try it"

Definition and Usage

length property sets or returns the number of elements in the array.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support length property.


grammar

Setting the number of array:

array.length= number

Return the length of an array:

array.length

technical details

return value: A number that represents the number of elements in the array of objects.
JavaScript version: 1.1


Array Object Reference Manual JavaScript array of objects