Javascript Math.round vs toFixed

Earlier today, I was using these two functions in combination and came across an article detailing that math.round was the better use of the two.

Here are my thoughts. Math.round will round off to the number of decimal places you are trying to get, however if the trailing decimal is a zero, it will not display. So $4.30 becomes $4.3 so if you use the (Math.round( whatever *100)/100).toFixed(2) would be your best combination.

Comments are closed.