The proper way to do alternate behavior for the first iteration, would be this... It's O(n) versus the authors O(2n)
if(attributeArray instanceof Array) {
if (attributeArray.length >= 1){
// do something with attributeArray[0]
for (var i = 1; i < attributeArray.length; ++i)
// do something different with attributeArray[index]
}
}