$ ./guess_the_languageProblem Solving — fix the bug
Problem Solving — fix the bug · hard · #219

Which fix removes the bug?

const orderId = 9007199254740993;
save(orderId); // saves ...992
  1. Round it with Math.round
  2. Keep it as a string or BigInt
  3. Store it with toFixed(0)
  4. Wrap it in Number() too
The literal is above Number.MAX_SAFE_INTEGER, so it rounds to the nearest double.
Play Problem Solving ▸