TypeScript - 字串長度屬性



返回字串的長度。

示例

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
typescript_strings.htm
廣告
© . All rights reserved.