此属性返回字符串中的字符数。
length - 语法
string.length
length - 示例
var uname=new String("Hello World") console.log(uname) console.log("Length "+uname.length) //returns the total number of characters //including whitespace
运行上面代码输出
Hello World Length 11
此属性返回字符串中的字符数。
string.length
var uname=new String("Hello World") console.log(uname) console.log("Length "+uname.length) //returns the total number of characters //including whitespace
运行上面代码输出
Hello World Length 11