My code below returns the expected results in VS code when I pass the given ‘num’ values in test cases. But when I try it in FCC, the code passes only the first test case and fails the rest. What is happening?

function sumFibs(num, n) {
const fib = [0, 1];
for (let i = 2; i <= n; i++) {
fib[i] = fib[i - 2] + fib[i - 1];
}
const odds = fib.filter((el) => el % 2 == 1 && el <= num);
const sum = odds.reduce((acc, curr) => acc + curr);
return sum;
}
sumFibs(4000000, 300);

‘num’ is the value mentioned in the challenge, the max value where we should limit the Fibonacci series. ‘n’ is the number that I used to construct the actual Fibonacci series. The solutions do not have this second argument but I followed such an approach.

the second argument in my code, 300 in this case, is the ‘n’ value I used to construct the actual Fibonacci series. It does not affect the result in VS code. I tried with the given ‘num’ values in FCC test cases in VS code, and all returned expected values.