Math.round方法将值的四舍五入返回到最接近的整数。
Math.round语法:
Math.round(y);
<html> <head> <title>JavaScript Math round() Method</title> </head> <body> <script type="text/javascript"> console.log(Math.round(0.7)); console.log(Math.round(3.4)); console.log(Math.round(18.8)); console.log(Math.round(-3.4)); </script> </body> </html>
日期:2020-04-18 01:09:26 来源:oir作者:oir