“length” is the property of an array object. It is a read-only property of an array and can be used to determine the size or length of the array or to access the last element in the array. It can be accessed with the help of dot notation or bracket notation.
For using the length property of the array object to determine the size or length of an array, follow the given syntax:
Or use it with the bracket notation:
Create an array of even numbers:
Determine the size of an array using the length property and store it in a variable “size”:
Lastly, print the length or size of the array:
Call the size() method with the defined array:
It gives an error “array.size is not a function” because the size() method is not available for the array: