number.toFixed(two); // Returns 43.21
The code above rounds our number up because it is closer to 43 than it is 42 (remember, we’re rounding to the nearest integer). If we wanted to round down, we would use the floor() method like so:
number.floor(two); // Returns 43.20
The floor() method rounds a number down to the nearest integer.
You can also use the ceil() method to round a number up to the nearest integer:
number.ceil(two); // Returns 43.22
Finally, rounding to two decimal places can also impact the performance of your code. If you’re doing a lot of calculations that involve rounding, it can slow down your code significantly. In some cases, it may even cause your code to crash.
In the end