What's the point of using function here Practice makes perfect


Why i have to create a function in the code when the code can just run without the function and get the same result?


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

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



I need same loop 100 times.what will you do now?do you want to write same loop 100 times or just want to call the function 100 times?


The purpose of using a function in this code with an empty parameter is so that you can call loop as a return function. So to end it, it would be loop(count); because loop is a function and count is a variable you can put into the parameters of the function to receive an output.


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