JAVASCRIPT Tutorial
'length' is a property of an array that indicates the number of elements it contains. It is a read-only property, meaning it cannot be changed directly. Instead, it updates automatically as elements are added or removed from the array.
To access the 'length' property of an array, simply use the .length notation, as seen in the following example:
const fruits = ['apple', 'banana', 'orange'];
console.log(fruits.length); // Output: 3
The 'length' property is dynamic, meaning it changes whenever the array changes. This is illustrated in the following example:
fruits.push('pear'); // Add an element
console.log(fruits.length); // Output: 4