JavaScript / October 1, 2010

First Post: JS Closure Example

While creating 10 <a> elements, each link pointing at a different id number. In that case, this example makes sense. However, the creation of the anonymous function block encloses a reference to the variable i but the value of i keeps changing as the for loop loops. That ends up yielding all 10 links linking

Read More