Swift Loop Through Array Javascript Methods Syntax Vs Semantics