cheesebagpipe
03-15-2003, 01:22 AM
Could someone explain this?
for (i=0; i<SomeArray.length; ++i)...
vs.
var SomeArrayLength = SomeArray.length;
for (i=0; i<SomeArrayLength; ++i)...
I've seen it posted - on this very board - that the second alternative is considered more efficient programming. Was wondering why...don't both approaches simply read a static property value (Array.length vs. function_call_object.SomeArrayLength)? Why would one be more efficient than the other?
for (i=0; i<SomeArray.length; ++i)...
vs.
var SomeArrayLength = SomeArray.length;
for (i=0; i<SomeArrayLength; ++i)...
I've seen it posted - on this very board - that the second alternative is considered more efficient programming. Was wondering why...don't both approaches simply read a static property value (Array.length vs. function_call_object.SomeArrayLength)? Why would one be more efficient than the other?