I want to delete values inside an array, but my code below doesn't work:
stations=['stations1','stations2']
wayPoints=[{location: "stations1"},{location: "stations2"},{location: "stations3"},{location: "stations4"}]
deletStations(){
let result=[];
this.stations.forEach(index1 => rest.push(this.arrayRemove(this.wayPoints,index1)) );
}
arrayRemove(arr, value) {
return arr.filter(function(ele){
return ele != value;
});
}
This code above doesn't remove the {location: "stations1"}, {location: "stations2"}
from wayPoints, any suggestions please?