JS toFixed & 负数 Math.round()

2023-02-20  本文已影响0人  bowen_wu

toFixed(2)

11.115.toFixed(2); // 11.12
111.115.toFixed(2); // 111.11

负数 Math.round()

Math.round(-11.1); // -11
Math.round(-11.5); // -11
Math.round(-11.6); // -12
上一篇 下一篇

猜你喜欢

热点阅读