One of my hobbies is number theory. Writing programs for number theory is not easy if you use only the data types offered by JavaScript. Big integer libraries, however, make things much easier. There are several big integer libraries, but the one I found easy to work with is Paul Olson's library.
The Olson library offers a BigInteger "class" with many methods.

Arithmetic methods

n.negate() - Returns -n
n.add(j) - Returns n + j
n.plus(j) - Alias for add. n.subtract(j) - Returns n - j.
n.minus(j) - alias for subtract(j)
n.multiply(j) - Returns n*j
n.times(j) - alias for multiply(j)
n.divide(j) - If n/j = q + r, where q is the (integer) quotient and r is the remainder, this method returns q.
n.divmod(j) - If n/j = q + r, where q is the quotient and r is the remiander, this method returns an object with two properties: quotient and remainder, both of which are BigInteger instances. quotient has the value q, remainder has the value r. n.abs() - Returns |n|
n.square() - Returns n^2.
n.mod(j) - Returns n % j.
n.modInv(j) - Returns an integer k such (k*n)/j has the remainder 1. For example, bigInt(3).modInv(11) = 4, because (3*4)/12 has a remainder of 1.
n.pow(j) - Returns n^j
n.modPow(exp, mod)

Relational methods

n.compareAbs(j)
n.compare(j) - Returns an integer < 0, = 0, or > 0 if n < j, n = j, or n > j, respectively.
n.equals(j) - Returns true if n == j
n.notEquals(j) - Returns true if n != j
n.greater(j), n.gt(j)
n.gt(j) is just an alias for n.greater(j)
n.lesser(j)
n.lt(j) is just an alias for n.greater(j).
n.greaterOrEquals(j)
n.geq is just an alias for n.greaterOrEqual(j).
n.lesserOrEquals(j)
n.leq is just an alias for n.lesserOrEquals()

Bit methods

n.shiftLeft(j)
n.shiftRight(j)
n.not()
n.and(j)
n.or(j)
n.xor(j)

Conversion methods

n.toArray(radix)
n.toString(radix)
n.toJSON()
n.valueOf()
n.toJSNumber()

Miscellaneous methods

n.isEven()
n.isOdd()
n.isPositive()
n.isNegative()
n.isUnit()
n.isZero()
n.isPrime()
n.isProbablePrime()
n.next()
n.prev()

One thing to keep in mind is that the BigInteger class is immutable. One example in which this can trip you up is explained. First, we declare a variable of type BigInteger like this:
var n = bigInt();
Now we can call BigInteger's add method like this:
n.add(j): Returns n + j; it does not modify n. So, for example, if you were trying to translate the JavaScript statement
n++;
to something using the BigInteger library, writing
n.add(j); // n is a BigInteger, and so is immutable
doesn't work, but the following does:
n = n.add(j); // Replaces contents of n with a new BigInteger

Below are some links to web pages I wrote that use his library to generate various types of large numbers.
Abundant numbers
Catalan numbers
Cullen numbers
Fibonacci numbers
Lucas numbers
Mersenne numbers
Poulet numbers