Where exact whole numbers end
The literal 9007199254740993 can't be stored, so it is rounded to the nearest storable number before your code even runs.
Every JavaScript number is a 64-bit floating-point value, which is why 0.1 + 0.2 isn't exactly 0.3, why NaN and Infinity exist, and why whole numbers above 2^53 − 1 need BigInt.
Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.
Ready for more? This phase has 5 hands-on exercises with automatic checks.
Practice questions
Write the code in the editor, run it, then open the model answer to compare.
Add the prices 19.99 and 5.01 so that the result is exactly 25 and log true when you compare it with 25.
Log whether Number("12px") is NaN using the correct test, and log the result of 100 / 0.
Log 2 to the power of 70 exactly.
Explain it without notes
Why does 0.1 + 0.2 not equal 0.3 in JavaScript, and how do you handle money?
What is NaN, why is NaN === NaN false, and how do you test for it?
What is Number.MAX_SAFE_INTEGER and what happens beyond it?
When would you use BigInt, and what are its limits?
Console
(nothing was printed)Expected console output
9007199254740991
9007199254740992
9007199254740992
9007199254740992
true
false