Spoiler alert: This post contains spoilers for Project Euler.
Problem 13

Large Sum
Approach
We have to sum one-hundred 50-digit numbers, and return the first 10 digits of the sum. This looks like a precision challenge.
Javascripts Number type tops out at 17 significant digits. This effectively means that digits beyond that are rounded off.
Run the following code and notice that both comparisons return true, even though we are declaring different numbers on the left-hand-side.
Here are a few more examples to hammer home the imprecision:
So if we want a precise sum, we'll have to use the BigInt type instead of Number. Theoretically with BigInt, there is no limit to the number of digits that we can store. In practice, the language engine will impose a bit limit. For Node.js, that works out to around 300 million digits. Solution #1 below solves the problem with BigInt.
But it's actually not necessary to obtain the precise sum here. Since we only need to submit the first 10 digits, and the Number type stores precision up to 17 digits, then the rounding errors won't affect the final answer. The 2nd solution also obtains the correct answer without any use of BigInt.
JS Solution #1 (BigInt)
JS Solution #2 (Precision doesn't matter)
Conclusion
The precise sum of all 100 numbers:
And the imprecise sum is:
In both cases, the first 10 digits are correct.