JavaScript – Length of Array
To get length of an array in JavaScript, access length property of this array.
length property returns the number of elements in this array.
The syntax to read the length property of an array arr
is
arr.length
Example
In the following example, we have taken an array in arr
. We shall find the length of this array arr
using length property.
index.html
ADVERTISEMENT
Conclusion
In this JavaScript Tutorial, we learned how to find length of an array using length property, with examples.