I believe my answer is right, but it isn't working. Did I miss something?


#1



7. Intro to "While" loops, lesson 5: Practice Makes Perfect


My code SHOULD work. I followed all instructions, and even used the hint when what I was trying wouldnt work. I keep getting the error message "Oops, try again.
Are you logging 'I'm looping!' to the console three times?".

I just can't find what I did wrong :frowning: Can anyone see something I missed?


//Remember to set your condition outside the loop!
var count = 0;

var loop = function(){
    while(count > 3){
        //Your code goes here!
        console.log("I'm looping!");
        count ++;
    }
};

loop();


#2

Ok, so at the start count is equal to 0.

Your loop will print out to the console "I'm looping!" as long as count will be greater than 3.

But 0 is not greater than 3, right? :slight_smile:


#3

GAHH! Thanks so much:( I was staring at this problem for a good 20 minutes and didn't see that!


#4

You're very welcome! :slight_smile:

Sometimes it's good to take a break and get back to the problem later. It works, trust me :wink:


#5

I'll keep that in mind! :grin: