I\'m very new to html, javascript, and css so please forgive if my question sounds idiotic to you. My question is how can I prevent the function toFixed() from
toFixed()
That's even simpler:
function truncateToDecimals(num, dec = 2) { const calcDec = Math.pow(10, dec); return Math.trunc(num * calcDec) / calcDec; }
So:
truncateToDecimals(123456.786) -> 123456.78