TypeScript 字符串Length属性
2019-01-09 14:28 更新
TypeScript - 字符串Length属性
Length属性返回字符串的长度。
示例
var uname = new String("Hello World")
console.log(uname)
console.log("Length "+uname.length) // returns the total number of characters
// including whitespace
在编译时,它将在JavaScript中生成相同的代码。
其输出如下:
Hello World Length 11
以上内容是否对您有帮助:

免费 AI IDE


更多建议: