Interview Q&A / JavaScript
JavaScript interview questions
Closures, the event loop, this, promises and the core language questions every frontend round asks.
Prefer rapid revision? Practise JavaScript short interview answers →
- Why is 0.1 + 0.2 not equal to 0.3 in JavaScript?
Numbers are stored in binary floating point (IEEE 754), and 0.1 and 0.2 cannot be represented exactly in binary, so the sum is 0.30000000000000004. Compare with a small tolerance, or do money maths in whole paise.
IntermediateQuick answer1 min read