Javascript Function Loop Through Array Powershell Update