...
/Solution Review: Closure, `setTimeout`, IIFE
Solution Review: Closure, `setTimeout`, IIFE
In this lesson, we will discuss the solution to the quiz in the previous lesson.
We'll cover the following...
We'll cover the following...
Question: Solution review #
Explanation #
You were asked to choose the codes that will give the correct output for the following code:
Let’s start by going through each option one-by-one.
Option A: Correct.
Run the code below:
As you can see, it gives the correct answer. The only modification you need to make is declaring the iterator i using the keyword let rather than var. This fix makes use of ES6. Changing var to let changes the implementation so that the value of i ...