Cache the length. Also use !== instead of &lt;