I have two var in html i want that when i divide first var with second then it show data like 19.30 instead of 19.3
var a =20;
var b=386;
var c=b/a
so c should show 19.30 instead of 19.3 in html java script.
I have two var in html i want that when i divide first var with second then it show data like 19.30 instead of 19.3
var a =20;
var b=386;
var c=b/a
so c should show 19.30 instead of 19.3 in html java script.
 
    
    As @Barmar suggested, i would also suggest the same. but make sure that the toFixed() will return a string not a number, so that we have to cast it manually either by inserting + operator in the beginning or by using Number() function.
var a =20;
var b=386;
var c= +(b/a).toFixed(2);
