In JavaScript, you can use the length attribute to find the length; the length attribute can return the length of the string (number of characters) or the number of elements in the array, the syntax format is "string.length" or "array.length" .
The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer.
javascript finds the length of an array/string
Output:
javascript length attribute
The length attribute can return the length of the string (number of characters), or return the number of elements in the array.
Grammar:
string.length 或 array.length
[Recommended learning:javascript advanced tutorial]
The above is the detailed content of How to find length in javascript. For more information, please follow other related articles on the PHP Chinese website!