Ntermediate Algorithm Scripting: Sum All Odd Fibonacci Numbers v#2

My code looks almost exactly like the code in the answer key, yet it doesn’t pass! What’s up with that?

function sumFibs(num) {
var prevNumber = 0;
var currNumber= 1;
var result = 0;

while (currNumber <= num) {
if (currNumber % 2 !== 0) {
result +=currNumber;

currNumber += prevNumber
prevNumber -= currNumber;
return result;


  • Next time you want to showcase a code, use the ` backtick so it is easier for everyone to read.
    See this post to find the backtick on your keyboard.
    The “preformatted text” tool in the editor (</>) will also add backticks around text.
  • Next time if you need a help from a challenge, you can use the Get Help button on the sidebar.
  • Don’t try to use the answer key before you ask here first. You won’t learn like that.
  • There is a difference between variable1 -= variable 2; and variable1 = variable 2 - variable1;.