I have foreach loop it loop to all locations and get gps location latitude and longtude of GPS1 and display it on google map
I need to collect all latitude and longtude from foreach loop then pass it to function LatLng 
const coordinates = new google.maps.LatLng(values of lat , values of lng);
 
- this.partDetailsService.getLocationData(locationArr).subscribe(res => {    
 -                  console.log(res);  
 -          res.forEach((item, index) => {  
 -              let dataLocation = res[index]['_source']['GPS1'];    
 -              console.log(dataLocation);     
 -              let loc = dataLocation.split(',');     
 -              console.log("After");    
 -              console.log(loc);              
 -              console.log(loc[0].trim());   
 -              console.log(loc[1].trim());   
 -      
 -               
 -           });  
 -             
 -           
 -   
 -          
 -       How to pass values of loc[0].trim() and loc[1].trim() result of foreach loop  
 -         const coordinates = new google.maps.LatLng(collection of lat result of foreach loop, collection of lng result of foreach loop);  
 -           const mapOptions: google.maps.MapOptions = {  
 -             center: coordinates,  
 -             zoom: 8  
 -           };  
 -         
 -           const marker = new google.maps.Marker({  
 -             position: coordinates,  
 -             title: 'Hello World!'  
 -           });  
 -         
 -           const map = new google.maps.Map(this.gmap.nativeElement, mapOptions);  
 -           marker.setMap(map);  
 -         }         
 -         );          
 -       
 -           
 -          
 -       }  
 - onManagelocations.component.html  
 - <div #mapContainer id="map"></div>