JavaScript math, round to two decimal places
Asked 07 September, 2021
Viewed 2.4K times
  • 62
Votes
var discount = Math.round(100 - (price / listprice) * 100);

This rounds up to the whole number. How can I return the result with two decimal places?

12 Answer