There are several built-in functions for rounding:
Math.floor
Rounds down: 3.1 becomes 3, and -1.1 becomes… Here’s the table to summarize the differences between them:
Math.floor
Math.ceil
Math.round
Math.trunc… For fractions:
Round using Math.floor, Math.ceil, Math.trunc, Math.round or num.toFixed(precision).