为什么当我用 Intl.NumberFormat 格式化为欧元时,最后一位数字和 € 之间的空格与空格键不同?

Why when I format with Intl.NumberFormat to euro, the whitespace between the last digit and the € is not the same as the spacebar?

我想知道为什么欧元的货币格式化程序使用不同于按 space 栏时生成的正常 space 的白色 space。这是一个代码示例,显示比较字符串变得复杂,特别是当我尝试对货币格式进行测试时。

const number = 123456.789;
let curr = new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(number)
console.log(curr); // expected output: "123.456,79 €"
console.log("123.456,79 €" === curr) // Expected output: true -> but it outputs false!

这是一个非中断 space %A0 而不是 %20。这是有道理的,因为如果换行,您不希望您的行以两行结尾。