5/11 "Practice makes perfect" - what exactly does "loop();" do?


#1

here is my code:
/*
var count = 0;

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

loop();
*/
my code works but i just don't understand what exactly "loop();" does? What are its purposes & roles? can someone provide me some explanations? Thanks


#2

I've the same question. Can somebody explain it?


#3

You wrapped your while loop in a function and loop() calls this function so the code in it can get executed.


#4

Thank you so much :wink: things r now pretty clear to me :+1: