Pass i variable to IIFE

The document states 'This will work as we expect it to, with each element getting the correct value of i...' which is not true, since, inside the IIFE, i is undefined
Merge pull request #26 from artoale/patch-1

Pass i variable to IIFE