I have a references problem that i can't handle with.
I have a array of strings. - ["String1","String1","String1"]
I am trying to map this array to have new array of objects { name: "String1", disabled: false } etc.
The code for that is:
let teamsWithProperty = teams.map(team => {
let object = {name: team, disabled: false}
return Object.assign({},object)
});
In next step i am creating an matrix of teamsWithPropery array:
for (let i=0; i<numberOfRounds; i++){
this.teamsMatrixForEachRound.push([...teamsWithProperty]);
}
The problem is that when i am trying to change a objects value in for example [0][0] element of matrix all of first elements have changes propery
(this.teamsMatrixForEachRound[0][0]).name = "Example"
I want to change property only of first object in matrix; But im getting: enter image description here