44
rated 0 times
[
48]
[
4]
/ answers: 1 / hits: 80494
/ 8 Years ago, wed, january 11, 2017, 12:00:00
I have an Object a
like that:
const a = {
user: {
…
groups: […]
…
}
}
whereby there are a lot more properties in a.user
And I would like to change only the a.user.groups
value. If I do this:
const b = Object.assign({}, a, {
user: {
groups: {}
}
});
b
doesn't have any other Property except b.user.groups
, all others are deleted. Is there any ES6 way to only change the nested property, without loosing all the other, with Object.assign
?
More From » ecmascript-6