類似於保留幾位小數,直接 n.toStringAsFixed()
例如:
1.toStringAsFixed(3); // 1.000
(4321.12345678).toStringAsFixed(5); // 4321.12346
1000000000000000000000.toStringAsFixed(3); // 1e+21
5.25.toStringAsFixed(0); // 5
16進制輸出
12.toRadixString(16); // c
類似於保留幾位小數,直接 n.toStringAsFixed()
例如:
1.toStringAsFixed(3); // 1.000
(4321.12345678).toStringAsFixed(5); // 4321.12346
1000000000000000000000.toStringAsFixed(3); // 1e+21
5.25.toStringAsFixed(0); // 5
16進制輸出
12.toRadixString(16); // c
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。