Helderroem
Feb 23, 2017 · 1 min read

Number.toFixed doesn’t round a number, it returns a string representation of a number with the specified number of digits after the decimal point, it just chops the rest of the numbers off, no rounding arithmetic goes on at all.

Rounding a Float in JS is actually quite complicated but there is an example of how to do it on the Math.round page of the MDN docs

    Helderroem

    Written by

    Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
    Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
    Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade