I have an array of objects. I would like to deep copy the array of objects and make some changes to each object. I want to do this without modifying the original array or or
Yes that looks good. You could also perform the modification when you are cloning, in order to avoid mapping over the array twice.
const users2 = users.map((u) => { const copiedUser = Object.assign({}, u); copiedUser.approved = true; return copiedUser; });