While adding 2 numbers I am getting a lengthy decimal part
Pasting the code below.
Number(200.59) + Number(100) = 300.59000000000003 //Expected result 300.59
While adding 2 numbers I am getting a lengthy decimal part
Pasting the code below.
Number(200.59) + Number(100) = 300.59000000000003 //Expected result 300.59
You could round the number to keep only 2 decimals:
var input = 300.59000000000003
var result = (Math.round(input*100)/100);
alert(result);