logic error for hiddenColumns._syncOrder ?

error happens when j == cols.length - 1 and cols[j].hidden = true