fround()Math对象的函数接受浮点数,并返回最接近的32位Number的单精度浮点表示形式。如果给定的数字本身是整数,则此函数返回相同的值。
其语法如下
Math.fround(160.98)
<html>
<head>
<title>JavaScript Example</title>
</head>
<body>
<script type="text/javascript">
var result = Math.fround(160.98);
document.write("Fround value: "+result);
</script>
</body>
</html>输出结果
Fround value: 160.97999572753906