+ 3
Convert my decimal to...
example: 263.2937273 = turn into 263 538.9362844 = turn into539
4 Réponses
+ 6
Math.round(number) rounds a number down, if the decimal place is less than 0.5, else up, if 0.5 or greater.
Math.floor(number) always rounds a number down, ignoring what the decimal place is.
Math.ceil(number) always rounds a number up.
+ 3
+ 1
use Math.round
+ 1
let num = 12.3456556;
alert( num.toFixed(0) );