ES6 - toLocaleString()



此方法使用環境區域設定,將數字物件轉換為代表數字的可讀字串。

語法

number.toLocaleString()

返回值

使用環境區域設定,返回代表數字的可讀字串。

範例

var num = new Number(177.1234);
console.log( num.toLocaleString());

輸出

177.1234
廣告