From get request I receive object array and I would like to assign that data to two different variables. One variable will get all the data, second variable will get a mutated version of that data.
The code I tried:
this.service.getEmployeeTimesheets().subscribe(res => {
this.timesheets = res;
this.mutatedTimesheets = res.map(j => {
delete j["keyName1"];
delete j["keyName2"];
});
console.log(this.mutatedTimesheets);
});
What happens is that for some reason timesheets value gets changed and mutatedTimesheets gets array of undefined