length – Get Array Length
array.length
array
is an array of elementslength
is the array property name
length
property returns the number of elements in the array
Examples
1. get length of the array numbers
let numbers = [4, 1, 7, 3, 2];
let output = numbers.length;
console.log('Array length : ' + output);
2. length of an empty array
let numbers = [];
let output = numbers.length;
console.log('Array length : ' + output);