Hello everyone, can someone help me to figure this trick


hi there can you explain to me how this code gets "a way to go "
var count=0

var loop = function(){


and am supposed to log three statements but i did not i just set the counter

and when i entered this code
var count=0

var loop = function(){
//Your code goes here!
console.log("I'm looping!");
count++ ;
i get this error "Oops, try again. Are you logging 'I'm looping!' to the console three times?"
any ideas ???



should it be run??

also you have to call the function after closing the function.


i don't know, i will try.
but how this strange code pass !!! i still did not figure it out
can you tell


please post you update code.


yap it worked also:
var count=0
var loop = function(){
Way to go! Start Next Lesson


may be you paased the lesson but loop is false :slight_smile:


right ? that's why am putting this question i want to know how this code passed
am asking my friends around , but i did not get a good answer yet


The while loop loops through a block of code as long as a specified condition is true.

in your code
is false.so it'll not run.is 3 less than 0?your condition should be true.
then it'll run and print I'm looping!

count++ ; //here now count is 1
now it'll check
while(1>3) //true so it'll run agian
so on.

now what about function?you have to call the funtion to make it any use.it doesn't execute when you declare it.so call the function at the end with function name.in your case
loop() //calling the function


thank you very much 'rcodeman' this is a very helpful explanation thanks you again


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