The number of elements in a JavaScript array can be retrieved by using the length property of the Array object. Note that this includes any undefined elements.
//Returns 4
var aryTest = [1,2,3,4];
document.write(aryTest.length);
If an element is then added at the 5th position of the array (JavaScript arrays are seeded at 0) the length of the array is [...]
Filed under: Internet, JavaScript, Programming, Software, Web | 2 Comments »