JavaScript often repeatedly accesses a certain object, for instance:
In the above example, the object document.images is accessed multiple times, forcing the browser to dynamically look it up twice during each loop (once to see if i
The way to fix this is to store a repeatedly accessed object inside a user defined variable, and use that variable instead of the actual object. Like this:
In the above script, document.images[] is referenced only half as many times as before. It goes to the array the second time, instead of the object.