We're live-coding on Twitch! Join us! FREE Webinar: Should I use React or Vue?


The length property of the String object returns the number of code points in a string object. It indicates the length of the string.

// 9


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.

Like this article? Follow @iChuloo on Twitter