ES6 - String Property Length


Advertisements


This property returns the number of characters in a string.

Syntax

string.length

Example : String constructor property

var uname = new String("Hello World") 
console.log(uname) 
console.log("Length "+uname.length)  
// returns the total number of characters 
// including whitespace

Output

Hello World 
Length 11 

es6_strings.htm

Advertisements