length
此属性返回字符串中的字符数。
语法 (Syntax)
string.length
示例:String构造函数属性
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