Beware - truncating an integer and using any of Math.floor, Math.ceil, and Math.round are NOT the same thing:
console.log(-23.9|0);// Result: -23console.log(Math.floor(-23.9));// Result -24console.log(Math.ceil(-23.9));// Result -23console.log(Math.round(-23.9));// Result -24console.log(23.9|0);// Result: 23console.log(Math.floor(23.9));// Result 23console.log(Math.ceil(23.9));// Result 24console.log(Math.round(23.9));// Result 24
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Beware - truncating an integer and using any of
Math.floor
,Math.ceil
, andMath.round
are NOT the same thing: