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