The length property sets or returns the number of elements in an array.
The length property sets or returns the number of elements in an array.
To get the length of an array:
array.length
To set the length of an array:
array.length = number
A Number, representing the number of elements in the array object
Return the length of an array:
var myArray = ["XML", "Json", "Database", "Mango"]; console.log( myArray.length);/* w ww.j av a 2 s.c om*/ //set length myArray.length = 2; console.log( myArray.length); console.log( myArray);