My main object looks like this:
const obj = {
data: {
'Puppies' : [],
'Kittens': []
}
};
I want to assign a value to the data field in data.Puppies[0].
When I try to do this using Object.assign() I get an error:
Unexpected token, expected , (83:12)
81 |
82 | return Object.assign({}, obj, {
> 83 | data.Puppies[0]: list
| ^
84 | });
85 | }
86 |
I'm not sure how I can accomplish my task. I need to use Object.assign() because I need to return a new object not the original one. I am doing this because of a Redux reducer in ReactJS.
Puppiesat index zero without mutating the original object, right?