When I round of the number 1.4034 to two decimals I get 1.4 instead of 1.40. How do I get 1.40? I can use toFixed(2) but that returns a string. I need it to be a float. Any ideas?
Here's my code
var num = 1.40345;
var stringnumber = Math.round(num * 100) / 100;
Update: The reason I want to this is because I'm using the chart library highchart which only excepts float values. The float value is printed on each bar and it looks odd when some values are with one decimal and some with two.