Moron Test v5


How does the new main function access the values of icon and i? How are those values passed from the moment created in the event listener to the scene level object’s main function? FYI this is an example of “closure.” Closure is the passing of variable values from an “outer” function to an “inner” function.

The main function is what accesses the values of both icon and i. It does this through the runScene function.

  1. eventListener is used to store the icon and i
  2.  the values of both i and icon are passed to runScene from the eventListener
  3. the runScene passes the values back to the main function we created.


Leave a comment

Your email address will not be published. Required fields are marked *