电脑培训

当前位置 /首页/职场人生/电脑培训/列表

JavaScript中用于四舍五入的Math.round方法讲解

此方法返回一个数四舍五入为最接近的整数的`值。

JavaScript中用于四舍五入的Math.round方法讲解

语法

d( x ) ;

下面是参数的详细信息:

x: 一个数字

返回值:

返回数字四舍五入为最接近的整数的值。

例子:

<a href="https://m.moshuiwu.com/article/pr4y/" title="查看更多Java的文章" target="_blank">Java</a>Script Math round() Method

这将产生以下结果:

First Test Value : 1Second Test Value : 21Third Test Value : 20Fourth Test Value : -20

TAG标签:讲解 四舍五入 #