X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY ANGULAR XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

JavaScript Array length Property

JavaScript Array Reference JavaScript Array Reference

Example

Return the length of an array:

fruits.length;

The result could be

4

Try it yourself »


Definition and Usage

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


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The length property is supported in all major browsers.


Syntax

Set the length of an array:

array.length=number

Return the length of an array:

array.length

Technical Details

Return Value: A Number, representing the number of elements in the array object
JavaScript Version: 1.1


JavaScript Array Reference JavaScript Array Reference

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates FREE Website Templates Free HTML Templates

SHARE THIS PAGE

facebook