anyway to change default round of tofixed to only round to upper number ?
it's default is like this :
0.012200.toFixed(3) = 0.012 #I need it be 0.013
0.012600.toFixed(3) = 0.013
This is entirely correct rounding behavior
"only round to upper number" is no longer rounding
const ceil = (n, decimals) => { const exp = 10 ** decimals; return Math.ceil(n * exp) / exp; };
It does work in this exact example = 0.012200 ? or i must first remove dot and zeros then do this ?
You should understand the code instead of just blindly copying it
I understood how it works
That’s what I do sometimes 😅
Обсуждают сегодня