10. to learn it, you gotta do it


#1


Hello,
It's is not clear to me why we need the syntax below.

"var getToDaChoppa = function( ) {
}
getToDaChoppa( );"

The code worked just fine without this syntax.

Thank you !


var getToDaChoppa = function(){
  
  var getToDaChoppa = false;
  
  do {
      console.log("Run the loop at least once plzzzzzz");    
  } while (getToDaChoppa);
}

getToDaChoppa();


#2

Of course, this code works without the function. But what to do if you need repeat same code few times? Don't Repeat Yourself (D.R.Y) is important programming principle and functions helps us to avoid repeating.
So, I think this lesson is for practice function with loop.


#3

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