Transcript from the "Exercise 1: Variable Scoping" Lesson
>> Kyle Simpson: Let's open up exercise one. You'll notice that I've created some functions here, and I've created some for loops and stuff. And here's our test case at the bottom. It needs to assert true, which is the case that the x value of 2 multiplied by 2. So we're saying that 4 needs to be the same thing that's returned if I call the function in this fns array at position 4.
[00:00:29] So in other words, I'm gonna loop over from 0 up to 5, not including, and I'm gonna add functions to an fns array. Each one of those functions needs to close over some variable such that when the function is called, it returns that value, okay? So looking at your IIFE here, looking at your var statements, figure out which ones of these should be made into lets and conts.
[00:00:55] And re-factor this code and set yourself up correctly with your closure. Should only take a few lines of code. So we'll just take a three-minute break, and then we'll talk about the solution.