transform: loop on length as not to fail on people modifying array.prototype