My while loop is not working

Tell us what’s happening:
My while loop doesn’t do anything?
Your code so far

function sumFibs(num) {
var sumOdd = 0;
var i;
var add = 1;
var fib = [1, 1];
while (fib[i + 1] < num) {
add += fib[i];
fib[i + 2] = add;



Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Safari/605.1.15.

Challenge: Sum All Odd Fibonacci Numbers

Link to the challenge:

You never initialized i


May I ask, what do you mean when you say that?

1 Like

Now it works, thanks.

1 Like

To initialize a variable means to set its initial, or first, value.

1 Like

So for example, is that like setting i to become var i = 1 type of thing?

1 Like