array.length in javascript

The length property sets or returns the number of elements in an array.
It starts from 1;

Syntax is array.length.

For Example:

var fruitsArr = new Array("Apple", "Mango", "Banana", "Chickoo", "Tomato");
fruitsArr.length;    // result will be 5

Click on below topics for step by step understanding.
How to get random element from Javascript Array and Display it.
Define an array in javascript
Math.random() function in javascript
Math.floor() function in javascript

 

 

Comments are closed.