JavaScript Glossary: String length
Publikováno: 26.3.2019
Basics
The length
property of the String object returns the number of code points in a string object. It indicates the length of the string.
Basics
The length
property of the String object returns the number of code points in a string object. It indicates the length of the string.
"scotch.io".length
// 9
https://scotch.io/embed/gist/8da338759983b9f7eb51ed5e5fddabd1
Syntax
const stringLength = string.length
Returns a number
The length
property returns the number of code points in a given string. When called on an empty string, it returns 0
.
Common Usage and Snippets
Verify password length
The length
property in conjunction with an if statement is used to verify the length of a password entry and returns a message if the length condition is satisfied or otherwise.
https://scotch.io/embed/gist/51a9943f18d81d943156becbc81c5ca8