In the previous activity, we reviewed some code that did not behave the way we wanted it to. We wanted code that when executed, printed out the value of i at the point in the for loop when the setTimeout was created. In this activity, we're going to be writing that code, but with a lot of restrictions in order to get more practice with closure and immediately invoked functions again.
-
Each call of
setTimeoutmust console log the value ofiwhen it is created. -
Do not change any code outside of the designated area, which means you're defining the first argument passed to
setTimeout.- Keep this in mind and remember the tools you used to solve the other activity regarding closure and immediately invoked functions
-
If you need more guidance, refer to the
hint.mdfile within the hint folder.