I am trying to add two floating point numbers
var sum = parseFloat(a) + parseFloat(b);
How do i set the decimal precision of the result to one?
Eg: 0.1+0.2 should give 0.3
use toFixed() function
var result = parseFloat(a+b).toFixed(1);