I love to hate JS with a passion, but did really enjoy this article. Sometimes I do have to interview candidates. Interestingly, several of these I do actually use.

The main one is 0.1 + 0.2 === 0.3 . Since I work for a POS company, we have to deal with a lot of currency calculations. The question is phrased in the way of “This happens, do you know why? How can it be avoided?”

Very few people get this question correct. However, you have one slight mistake. The rounding error is not a problem with JS, per se. You will encounter this error in any other dynamic or strictly typed language that uses binary floating-point types since many numbers cannot be represented exactly with a pow2 exponent.

Written by

I’m a data nerd and TDD enthusiast originally from Sydney. Currently working for Uber in New York. My thoughts here are my own. 🤓 elliotchance@gmail.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store