http://closure-compiler.appspot.com/home
And whether I checked "Simple" or "Advanced" I got:
for(var a = 0;a < arr.length;a++)
So it's not optimizing that pattern yet.
Such determinations are a pretty common thing for an optimizing compiler to attempt:
http://en.wikipedia.org/wiki/Loop-invariant_code_motion
http://closure-compiler.appspot.com/home
And whether I checked "Simple" or "Advanced" I got:
for(var a = 0;a < arr.length;a++)
So it's not optimizing that pattern yet.