forked from mirrors/0ad
07ed959422
Since variables declared with `var` don't respect all scopes, when used in a loop it doesn't create a new variable each iteration. The initializer value is always assigned to the same variable. That makes problems when the variable is used in a callback. To work around that the variable is copied in to a IIFE. When not using `var` the iife isn't required. Ref: #7812