Sum all odd fibonacci numbers not passing one test

let fib = function(n) {
  if (n <= 1) {
    return n;
  }
  else {
    return fib(n - 1) + fib(n - 2);
  }
}

function sumFibs(num) {
  let sum = 0;
  let n = 1;
  while (fib(n) <= num) {
    if ((fib(n) % 2) === 1) {
      sum += fib(n);
    }
    n++;
  }
  return sum;
}

sumFibs(4000000);

It’s not passing only one test, i.e. the one mentioned… can’t figure out why?

To protect campers from crashing their browsers with infinte loops or inifinte recursion, FCC uses an execution time limit. If a solution is inefficient it is possible that it will require more than the allowed time in order to complete, even if it does not contain an infinite loop.

Yep, tried it on repl.it, worked just fine :). Thanks for the heads up!!