Let's say I have an object like
const team = {
name: "something",
members: [1, 2, 3],
};
and in the above object I want to append the value 4 to the array?
would this be acceptable code?
const newTeam = { ...team, members: team.members.concat(userId) };
I am using concat because it does not modify the array and I don't think I have to use map in this instance. Is my thinking, correct?