Start a conversation

Rounding numbers

If you want to round numbers to an X number of decimals, you can use the templates below. Change the number after 'toFixed(' to change the number of decimals.

To round up to 0 decimals, use:

var num = {your_number_variable};
num.toFixed(0);

To round up to 2 decimals, use:

var num = {your_number_variable};
num.toFixed(2);
Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. Castor Support Team

  2. Posted
  3. Updated