Alternative Solution to Problem


#1


https://www.codecademy.com/courses/javascript-beginner-en-ASGIv/1/1?curriculum_id=506324b3a7dffd00020bf661#


I've looked at the suggested solution after completing the exercise using a different method. Are there any problems with my solution? What are the advantages of the suggested solution over what I did?


var loop = function(times)
{
	while(times > 0)
	{
		//Your code goes here!
		console.log("I'm looping!");
		times --
	}
};

loop(3);


#2

Sure, it works... There's really no advantage v. disadvantage in terms of this, it's just the inverse of the suggested solution.


#3

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