1
在爲值格式化程序服務編寫測試時,我注意到有一些關於Number.prototype.toLocaleString("sv-SE")
的問題。如何正確聲明由Number.prototype.toLocaleString(「sv-SE」)返回的值?
let myValue = (100000).toLocaleString("sv-SE");
console.log(typeof myValue);
console.log(myValue);
console.log(myValue === "100 000"); // false, why?
我希望最後的日誌語句返回true
。但它不,爲什麼?
即字符是[U + 00A0(NO-BREAK SPACE)](http://www.fileformat.info/info/統一字符編碼/炭/ 00A0/index.htm的)。不是正常的空格字符([U + 0020](http://www.fileformat.info/info/unicode/char/0020/index.htm))。 – Phylogenesis
對,明白了,只需要使用正確的空格字符。你不把這個作爲答案? –