Using array.forEach would be more appropriate here.