How can I round down a number in JavaScript?
math.round() doesn\'t work because it rounds it to the nearest decimal.
math.round()
I\'m not sure if there is
This was the best solution I found that works reliably.
function round(value, decimals) { return Number(Math.floor(parseFloat(value + 'e' + decimals)) + 'e-' + decimals); }
Credit to: Jack L Moore's blog