Es6-math-round
提供:Dev Guides
ES6-数学のround()関数
数値を最も近い整数に丸めます。
構文
Math.round( x ) ;
パラメータ
- X-数値を表します
例
console.log("---Math.round()---")
console.log("Math.round(7.2) : "+Math.round(7.2))
console.log("Math.round(-7.7) : "+Math.round(-7.7))
出力
---Math.round()---
Math.round(7.2) : 7
Math.round(-7.7) : -8