JavaScript · Senior · Question 30 of 75

What happens with 10n + 1?

Explanation

Implicit mixing is forbidden to avoid losing precision. Be explicit: 10n + BigInt(1) or Number(10n) + 1. BigInt is needed for integers larger than Number.MAX_SAFE_INTEGER (2^53 − 1): IDs, cryptography. JSON.stringify doesn't support it.

Further reading

Problem with a question

JavaScript · Senior · question 30

Test yourself

Take the JavaScript · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz