选择题1512/1631输出什么?

1function getFine(speed, amount) { 2 const formattedSpeed = new Intl.NumberFormat({ 3 'en-US', 4 { style: 'unit', unit: 'mile-per-hour' } 5 }).format(speed) 6 7 const formattedAmount = new Intl.NumberFormat({ 8 'en-US', 9 { style: 'currency', currency: 'USD' } 10 }).format(amount) 11 12 return `The driver drove ${formattedSpeed} and has to pay ${formattedAmount}` 13} 14 15console.log(getFine(130, 300))
难度:
2021-07-02 创建

本题为"单选题"

参考答案:

正确选项:B:The driver drove 130 mph and has to pay \$300.00

通过方法 Intl.NumberFormat,我们可以格式化任意区域的数字值。我们对数字值 130 进行 mile-per-hour 作为 uniten-US 区域 格式化,结果为 130 mph。对数字值 300 进行 USD 作为 currentcyen-US 区域格式化,结果为 $300.00.

最近更新时间:2021-07-03

赞赏支持

题库维护不易,您的支持就是我们最大的动力!