recently I was learning ng2, but found a problem with array assignment. I just wanted to assign the value of list1 to list2, but they made an association.
Code:
export class AppComponent {
public list1 = [];
public list2 = [];
constructor() {
this.list1 = ["1","2"];
this.list2 = this.list1;
this.list1.push("3");
console.log(this.list2);
}
}
output:
(3)["1", "2", "3"]