我想將結果四舍五入到小數點后兩位。我已經嘗試過 Math.floor*(Math.pow (1.02,7)*100)/100 但我得到的是 1,150 而不是 1,148.69 - 我打算返回的答案。我的代碼片段 atm:function money (amount) { return amount*(Math.pow (1.02,7))}money(1000);
四舍五入到小數點后兩位 (Javascript)
holdtom
2023-01-06 15:40:52