34,333
edits
Changes
→Rounding and Truncating Numbers with the the Math Object
The ''ceil()'', ''floor()'' and ''round()'' methods of the JavaScript Math object can be used to round numbers up and down:
'''Math.ceil()''' - Rounds a number up to the nearest integer
'''Math.floor()''' - Rounds a number down to the nearest integer
'''Math.round()''' - Rounds a number to the nearest integer (i.e up or down depending on which is closest)