Problem 10: Summation of primes

Tell us what’s happening:
My code gives the correct output at my PC but I’m getting failed tests on the freeCodeCamp Test Runner

Your code so far


function isPrime(n) {
    if (n <= 0) return false
    if (n == 2 || n == 3) return true
    if (n > 3) {
        var div = 2
        while (div < n) {
            if (n % div == 0) return false
            div += 1
        }
        return true
    }
}

function primeSummation(n) {
    var sum = 0
    for (var i = 0; i < n; i++) {
        if (isPrime(i)) sum += i
    }

    return sum
}

primeSummation(2000000);

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36.

**Link to the challenge
Coding Interview Prep
-> Project Euler => Problem 10

You are probably triggering the infinite loop protection, you need a code with better performance