Something like this works, but looks a bit clumsy:
for (i in {foo: 1, bar: 1, wah: 1}) { // loops through foo, bar, wah
console.log(i + " haha"); // can view using Firebug or Chrome
}
if using an array, I don’t want to create any global temporary variable for the array… Also, this has to work in any modern browser IE7 / FF / Chrome / Safari. thanks.
You need to declare
ifor certain browsers.I would use the initialization section of a for loop to declare the variables.
Array: