Another way (not recommended) to do this is to use the deprecated
- Expression Closures.
Changes in destructuring
for ( var [key, value] in array ). However, that made it impossible to destructure the values of an array - that were arrays (i.e., when an iterator returns an array of the current key-value pair). This has been resolved now. (bug 366941). One can, however, use
for ( var [key, value] in Iterator(array)).