Firefox与Chrome中Intl.NumberFormat格式化LBP货币的行为差异
Intl.NumberFormat格式化黎巴嫩镑(LBP)时Firefox与Chrome的行为差异
使用Intl.NumberFormat函数格式化黎巴嫩镑(LBP)时,Firefox和Chrome存在明显行为差异:
执行以下代码:
const options = { style: "currency", currency: "LBP" }; const numberFormat = new Intl.NumberFormat("en-GB", options); console.log(numberFormat.format(654321.987));
- 在Firefox中输出结果为:
"LBP 654,321.99" - 在Chrome中输出结果为:
"LBP 654,322"
我想知道这种差异产生的原因,是浏览器的特定设置还是Intl实现细节导致的?
PS:我了解minimumFractionDigits属性,但我的问题更聚焦于这种差异本身——我期望得到与Firefox一致的结果,不理解Chrome为何会直接向上取整到整数。
内容的提问来源于stack exchange,提问作者hchic
相关产品推荐
相关产品推荐

