During the iteration of the results
property, I am assigning its value to another property called moreResults
. After this assignment, I proceed to remove array elements from the testDetails
within the moreResults
property. However, it seems that the removal of these elements affects not only the moreResults
property but also the original results
property.
ngOnInit(): void {
for (let i = 0; i < this.results.length; i++) {
this.moreResults.push(this.results[i]);
this.moreResults[i].testDetails = [];
}
console.log(this.moreResults);
console.log(this.results);
}