Sum All Odd Fibonacci Numbers...44

What’s wrong . everything is working except tjhe last one

Your code so far

function sumFibs(num) {
  //b3d ama ngeeb el numbers kolha fee array , mommken n3mlha filter lee el odd numbers wa b3deen reduce 
  let newa = [];
  let frst = 1;
  let scnd = 1;
  let thrd = 0;
    thrd = frst + scnd;
    frst = scnd;
    scnd = thrd;
  return newa.filter(x=> x%2==1?true:false).reduce((a,b)=>a+b)



Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36.

Link to the challenge:

Dump the array and investigate … Also notice that the previous test is with a number just 1 less, which is a good sign you have an off-by-one error (which you do).

1 Like

actually i just needed to change that


to that


Exactly, as the instructions said. :slight_smile:
It’s still an off-by-one error btw.


When you’re looping over integer numbers, the difference between greater-than and greater-or-equal is exactly 1.