Linked Questions

Popular Questions

JavaScript round up without decimal

Asked by At

I have a code in JavaScript

shipingcostnumber * parseInt(tax) / 100 + shipingcostnumber

returns number as 6655.866558 so I cover it in parentheses like:

(shipingcostnumber * parseInt(tax) / 100 + shipingcostnumber)

now it returns like 73213.8 which is correct number.

I need this number to be round up to 73214 and without any decimal.

So I made :

var nf = new Intl.NumberFormat('en-US', {
  maximumFractionDigits:0, 
  minimumFractionDigits:0
});

and changed my code to:

nf.format(shipingcostnumber * parseInt(tax) / 100 + shipingcostnumber)

and it returns 73,214. It did round up my number but also added , how do I remove that decimal?

Related Questions