Also, making sure elements.length is calculated just once, I initialize it to that value rather than assigning elements.length to some variable.