TypeScript - 字串 toString()



此方法返回一個表示指定物件的字串。

語法

string.toString( )

返回值

返回一個表示指定物件的字串。

示例

var str = "Apples are round, and Apples are Juicy."; 
console.log(str.toString( ));

編譯後,它將在 JavaScript 中生成相同的程式碼。

其輸出如下:

Apples are round, and Apples are Juicy.
typescript_strings.htm
廣告

© . All rights reserved.