Intl.NumberFormat "compact" 没有返回格式正确的数字

spe*_*ius 5 firefox google-chrome number-formatting ecmascript-6

按照这个例子,我试图让大数字格式化得更紧凑:

console.log(
    new Intl.NumberFormat(
        'en-GB', 
        { notation: "compact" , compactDisplay: "short" }
    ).format(987654321)
);
Run Code Online (Sandbox Code Playgroud)

但是我在 Firefox 和 Chrome 中的结果不同。我得到“987,654,321”而不是示例中预期的“988M”。任何人都知道为什么会这样以及我如何解决它?

小智 1

我遇到了同样的问题,我试图寻找一个逻辑原因,我发现了这个官方文档: https://v8.dev/features/intl-numberformat#notation 据我了解“compact”选项,它仍然没有得到完全支持