+ 3

Convert my decimal to...

example: 263.2937273 = turn into 263 538.9362844 = turn into539

21st Oct 2018, 7:54 AM
Jingga Sona
Jingga Sona - avatar
4 Answers
+ 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.
21st Oct 2018, 8:06 AM
Rowsej
Rowsej - avatar
+ 3
Rowsej Mohit the coder (M.S.D) Taste Thanks For Your Hwlp🙏👍😊
22nd Oct 2018, 3:14 AM
Jingga Sona
Jingga Sona - avatar
+ 1
use Math.round
21st Oct 2018, 7:56 AM
Taste
Taste - avatar
+ 1
let num = 12.3456556; alert( num.toFixed(0) );
21st Oct 2018, 7:59 AM
MsJ
MsJ - avatar