除了 .toFixed() 方法之外,还有其他方法可以在 suitlet 中将小数点后 2 位的数字打印为小数点后 3 位吗?
is there any other way than .toFixed() method, in suitlet to print a 2 decimal placed number as a 3 decimal place?
suitlet 有没有办法将小数点后 2 位的数字打印成小数点后 3 位? (例如,我的值为 1300.12,我希望将其打印为 1300.120)。我试过 .toFixed(3) 方法,但我的 suitlet 显示错误。”
1300.12.toFixed(3) 对我有用,因为 well.It 也应该对你有用,但无论如何尝试实现这个:
financial = (x) => {
return Number.parseFloat(x).toFixed(4);
}
console.log(financial(123.456));
希望这对你有用
console.log(Number.parseFloat(1300.12).toFixed(3))
suitlet 有没有办法将小数点后 2 位的数字打印成小数点后 3 位? (例如,我的值为 1300.12,我希望将其打印为 1300.120)。我试过 .toFixed(3) 方法,但我的 suitlet 显示错误。”
1300.12.toFixed(3) 对我有用,因为 well.It 也应该对你有用,但无论如何尝试实现这个:
financial = (x) => {
return Number.parseFloat(x).toFixed(4);
}
console.log(financial(123.456));
希望这对你有用
console.log(Number.parseFloat(1300.12).toFixed(3))