don't use for loop to iterate over array