I think I found a bug!

function sumFibs(num) {
  var arr = [1, 1];
  for (var i =0; i < num - 2; i++) {
    arr.push(arr[i] + arr[i + 1]);
  return arr;


I don’t know if something is broken on fcc or something is wrong with my pc but I have tried this code in multiple web browsers and every time I try to run it the window freezes.

You are not supposed to be returning an array. You are supposed to be returning a single number which is the sum of all odd Fibonacci numbers that are less than or equal to num. Since your code returns an array, the FCC tests attempt to display the result (an array) and when the test gets to sumFibs(4000000) it is too much for the browser. Make sure you are returning a number instead of an array.

1 Like

Ohh! right I got it! I now understand how the challenges work. I completed the challenges tho… Thanks!

Typically it is not an issue, but because the FCC tests for this one attempt to display what you return in the console, that is a very large array you have created to display, so it freezes. I recommend testing each test case in a site like https://repl.it and use console.log statements to see what just a single test case produces. When you get all the tests to pass, then paste your code in the challenge again (removing any console.log statements) and run the tests.

1 Like