5. Practice Makes Perfect


5.Practice Makes Perfect

I don't understand why I get "Oops, try again. Hey now--only one console.log() call!"

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



Remove the console.log that comes after you call your function,:slight_smile:


Thank you so much! :smile:


You're welcome. :grin:


Can anyone explain why count++; comes after console.log and not after while, like in for loops usually?


Can anyone explain - Why are the parenthesis that come after function empty? Same with the parenthesis after loop?


Is an increment of the loop.

It all depends on how you want the loop to function. Incrementing it before the console.log would result in an error or infinite loop. :slight_smile:


This is the function call when a function has no parameters the function call will have nothing in the parentheses. :grin:


remove the:

console.log("I'm looping!");

at the very bottom line then call the function 3 times that means you should add 2 more loop();



works for me :slight_smile:


Can anyone explain to me why
var loop = function() is in there.

What it is doing?


I believe calling the loop() 3 times would result in "I'm loopin" being printed out 9 times?


If you need help create a +New Topic
With your code, error and lesson URL