Hello,
I can't pass this algorithm because FCC says I don't pass the test cases. However when I call the same numbers in the test functions myself the correct answer is returned to the console.
Is there something I should fix?
Challenge Sum All Odd Fibonacci Numbers has an issue.
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Firefox/45.0.
Please describe how to reproduce this issue, and include links to screenshots if possible.
My code:
var prev = 0;
var current = 1;
var next = 0;
var sum = 0;
function sumFibs(num) {
while (current <= num){
if (current%2 !== 0){
sum += current
}
next = current + prev;
prev = current
current = next
}
return sum;
}
sumFibs(75025);