The length property returns the number of elements in an array in the form of a 32-bit unsigned integer. We can also say that the length property returns a number that represents the number of array elements. The return value is always larger than the highest array index.
The length property can also be used to set the number of elements in an array. We have to use the assignment operator in conjunction with the length property to set an array's length.
Set the length of an array: