Need present whole number with 2 decimals (5.00) in javascript

javascript

Solution

You can use `.toFixed()`, but there's no need to manually round the value to the nearest 0.01 first - the `.toFixed` function will do that for you.

var str = Math.abs(21600 / 3600).toFixed(2);

Problem

I have this ``` Math.round((Math.abs(21600 / 3600))*100)/100 >> 6 # want 6.00 Math.round((Math.abs(21000 / 3600))*100)/100 >> 5.83 # This is right ``` I need 2 decimals on whole number.

Original source

Related problems