JavaScript Tutorial - Obtain an Array's Length

This tutorial will demonstrate how to measure the length of any array with the length property.

Code Example
  1. var chevCar = new Array("Nova", "Impala", "Corvette");
  2. alert("The array chevCar contains " + chevCar);
  3. alert("The length of the array is " + chevCar.length);
  4. var chevy = chevCar.pop();
  5. alert("But now, it contains " + chevCar);
  6. alert("The new length of the array is " + chevCar.length);
  7. alert("The removed element is " + chevy);

Click on the button below 5 times to see each step in the process.