Array Properties & Methods part 1

The length Property



JavaScript arrays have useful built-inproperties and methods.

An array's length property returns the number of it's elements.
var courses = ["HTML", "CSS", "JS"];
document.write(courses.length);
//Outputs 3
Try It Yourself

The length property is always one more than the highest array index.
If the array is empty, the length property returns 0.

Comments

Popular posts from this blog

String Operators

Introducing object part 3

Associative Arrays part 2