Float sum with javascript [duplicate]
Solution 1:
Once you read what What Every Computer Scientist Should Know About Floating-Point Arithmetic you could use the .toFixed()
function:
var result = parseFloat('2.3') + parseFloat('2.4');
alert(result.toFixed(2));
Solution 2:
(parseFloat('2.3') + parseFloat('2.4')).toFixed(1);
its going to give you solution i suppose