Swift Loop Through Array Javascript Length