[英]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) 也適用於我。它也應該適用於你,但無論如何嘗試實現這個:
financial = (x) => {
return Number.parseFloat(x).toFixed(4);
}
console.log(financial(123.456));
希望這對你有用
console.log(Number.parseFloat(1300.12).toFixed(3))
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.