Javascript – Extremely large numbers in javascript


I'm working on the Project Euler problems (currently question 13).

For this question I have to find the first 10 digits of the sum of 100 numbers all of a size similar to this:


I think I could use something like Java's BigInteger, but I started solving the problems in JavaScript (I'm trying to boost my js abilities for work), and I would like to continue using it, even to solve this problem.

I'd like to stick to pure JS if possible.

Best Solution

You are going to need a javascript based BigInteger library. There are many to choose from. Here is one

You can use it like this

var n = bigInt("91942213363574161572522430563301811072406154908250")