I need help splitting my data stored in a single array into multiple arrays. Currently, I am using "|" as the separator to split them, but I want to store each split value in separate arrays.
https://i.sstatic.net/wW5QV.png
JavaScript:
{
$scope.polygonPoints.push($scope.apiResult[i].LatLng)
$scope.polyLineCord.push($scope.polygonPoints[i].split("|"))
console.log($scope.polygonPoints)
for (var k= 0; k < $scope.polyLineCord.length; k++) {
console.log($scope.polyLineCord)
$scope.Lat.push($scope.polyLineCord[k].split(',')[0]);
$scope.Lng.push($scope.polyLineCord[k].split(',')[1]);
L.marker([$scope.Lat[k], $scope.Lng[k]], {icon: greenIcon}).bindPopup($scope.apiResult[k].DESCRIPTION).addTo(cities);
}
}
Apologies if the wording is confusing, but essentially, I want values like "1.309..., 103.844" to be stored in array[0] and "1.30916..., 103.845..." to be stored in array1, and so on.