Javascript - The length Property
Code Life
By Pierre Marsaa
How Many Elements?
You already know .length for strings: it counts characters. Arrays have it too, and it counts elements:
↗️
Loading editor...
↶
↷
Note that length is a property, not a method: no parentheses after it. Writing team.length() would throw an error.
An empty array has a length of 0, and the count doesn't depend on what the elements contain:
↗️
Loading editor...
↶
↷
Verify