Interview practice question
Large IDs lose precision in JavaScript
Frontend Engineering · JavaScript Core · Intermediate
IDs from your API, like 9007199254740993, change slightly when parsed in JavaScript. Why, and how do you fix it?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Numbers above 2^53 lose precision.
- Number.MAX_SAFE_INTEGER.
- Send IDs as strings.
- BigInt for arithmetic.
- JSON.parse limitations.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.