Avoiding overflows while computing $e^x$ by Taylor series
Of course there are better numerical ways to compute exponential, but if you want to use Taylor expansion only, the better approach is to reformulate the expansion to avoid computing large nominators and denominators. This leads to an $O(n)$ algorithm, where $n$ is the number of iterations. Yours is $O(n^2)$ if you compute factorial and power literally (probably the python library is computing factorial with a gamma function and power with exp).

Here is a javascript program. print() is a function to write strings to console.

function myexp(x, max_itr)
{
    var y = 1.0, t = 1.0;
    for (var i = 1; i &lt; max_itr; ++i) {
        t *= x / i;
        y += t;
    }
    return y;
}

var x = 1.2;
print("Math.exp: " + Math.exp(x));
print("10 iterations: " + myexp(x, 10));
print("99 iterations: " + myexp(x, 99));


The output is:

Math.exp: 3.3201169227365472
10 iterations: 3.3201150098285708
99 iterations: 3.3201169227365472


EDIT:

Alternatively, you can reformulate Taylor expansion as:

$$ e^x = 1 + \frac{x}{1}\left(1+\frac{x}{2}\left(1+\frac{x}{3}\left(1+\cdots\right)\right)\right)$$

An implementation in javascript:

function myexp2(x, max_itr)
{
    var y = 0.0;
    for (var i = max_itr; i &gt;= 1; --i)
        y = 1.0 + x / i * y;
    return y;
}