Sum All Primes browser question

I was working on the Sum All Primes question and made this code:

function sumPrimes(num) {
  var primeArray = [];
  //Add all odd prime numbers to array
  for (var i = 2; i <= num; i++) {
    var isPrime = true;
    for (var j = 2;j < i;j++){
      if (i % j===0) {
        isPrime = false;
    if(isPrime) {

  //calculate final total
  var output = 0;
  for (var k = 0; k < primeArray.length; k++) {
    output += primeArray[k];
  return output;

When I test the code on and Chrome for sumPrimes(977), I get 73156 which is the correct answer. However, when I test the code on Firefox, the sum is inconsistent and gives me a different answer each time.

Is this a browser issue or is there something wrong with my code?