Tell us what’s happening:
I don’t get why my code isn’t passing last test. I used <= as you can see, but it is still broken. Could you figure out why that’s happening?
Your code so far
function sumFibs(num) {
let fibOne = 1;
let fibTwo = 1;
let fibArr = [];
let finalNum = 0;
while(fibTwo <= num) {
fibArr.push(fibOne);
fibArr.push(fibTwo);
fibOne = fibOne + fibTwo;
fibTwo = fibOne + fibTwo;
}
for(let i = 0; i < fibArr.length; i++) {
if(fibArr[i] % 2 == 1) {
finalNum = finalNum + fibArr[i];
}
}
return (finalNum);
}
sumFibs(75025);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36.
It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.
We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.