Comment on Google Closure: How not to write JavascriptparentComments−jeff1816yIt would have to determine that arr.length doesn't change during the loop. Pretty difficult problem. :)−gojomo16yI'm unsure if the smiley means you're being sarcastic, but if not:Such determinations are a pretty common thing for an optimizing compiler to attempt:http://en.wikipedia.org/wiki/Loop-invariant_code_motion
Comments
It would have to determine that arr.length doesn't change during the loop. Pretty difficult problem. :)
I'm unsure if the smiley means you're being sarcastic, but if not:
Such determinations are a pretty common thing for an optimizing compiler to attempt:
http://en.wikipedia.org/wiki/Loop-invariant_code_motion