Besides the first example having a mistake, their suggested solution still isn't best practices;
for (var i = 0, len = myArray.length; i < len; i++)
{
...
}
Will perform far faster than doing the comparison on each iteration. Might not be noticeable on an array of 10, but certainly would be on an array of 1k.