Math.round only if decimal is 0 code example Example: round number 2 decimals javascript Math.round((num + Number.EPSILON) * 100) / 100