- let lati:string;
- let long:string;
-
- 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); success
- console.log(loc[0].trim()); success
- console.log(loc[1].trim()); success
- lati=loc[0].trim();
- long=loc[1].trim();
- });
- latitude= result of loc[0].trim after loop finish
- longtude= result of loc[1].trim after loop finish
- and what datatype assigned to two variables ?
suppose I have on dataLocation that store GPS1 as following
52,70
30,40
20,60
50,100
then
latitude variable will have 52,30,20,50
longtude variable will have 70,40,60,100
Ho to create two variables that can give me values above ?