I can't seem to get a nice number rounded to the nearest hundredth (ie. 12.57 instead of 12.57000000008).
var example = {
user : "John",
dollars: 12.57
};
setInterval( function() {
example.dollars += (parseInt(Math.floor(Math.random()*2000 + 500)) / 100);
console.log(example.dollars);
}, 1000);
I keep getting values like:
15.20000000008
88.54000000007
86.36000000008
Am I setting something wrong in my Math function?
Note: This is in node.js