javascript array index test
<p>if I have an array <code>myArray</code> which I am looping through:</p>

<pre><code>for(var i=0;i&lt;myArray.length;i++) {
   if(myArray[i] == myArray[i+1])
      //do something
}
</code></pre>

<p>Clearly, <code>myArray[i+1]</code> will fail on the last iteration.  Short of testing if <code>i == (myArray.length - 1)</code>, is there a clean way to not fail on that if statement and just have it evaluate to false (if <code>myArray[i+1]</code> is out of bounds)?</p>
