5. Practice makes perfect


#1


Hey

The activity wants me to print a string without using 3 console.logs. I think I am able to do it with the code below but I get the error message: "Oops, try again. Hey now--only one console.log() call!". My output is "I'm looping! I'm looping! I'm looping!".

Cheers


var counter = 0;

var loop = function(){
    while (counter < 3){
        console.log("I'm looping!");
        counter++;
    }
}

loop();


#2

Everything looks good other than you should use a semicolon after the closing } of your function.


#3

I guess just ignore the error message perhaps. Cheers


#4

In this case yes, but always pay close attention to error messages - they are very helpful! Sometimes codecademy's custom error messages will throw you off though.


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.