var details = new Array();
Note the last line saying undefined. This is because we have not added any element to details
Displaying elements by using length Property
In above code we used numbers inside for loops because we already know the number of elements present inside array. If we don't know the number of elements present inside array then we can use the array length property inside for loop to display the elements.