Problem 2: Even Fibonacci Numbers (2)

Problem 2: Even Fibonacci Numbers (2)
0

#1

Tell us what’s happening:
My function passed all test and get all results right expect I got

" Your function is not returning the correct result using our tests values. "

I don’t know what should I do to pass this error?!!!

My code*

function fiboEvenSum(number) {
  let fibo = [1, 2];
  for (let i = 2; i < number; i++)
    fibo.push(fibo[i - 1] + fibo[i - 2])
  return fibo.filter(v => v % 2).reduce((p, c) => p + c, 1)
}

Link to the challenge:
https://learn.freecodecamp.org/coding-interview-prep/project-euler/problem-2-even-fibonacci-numbers


#2

It looks as though that test may be buggy, as that’s the text initially presented (see image) before you run the tests. Report it in GitHub Issues


#3

Not sure if this one is still current, but as I had the same issue here’s the solution to it; you have to initialize the starting array (fibo in your case) with [1, 1, 2] …as the fibonacci is starting (seems the fCC description is slightly buggy here).