I have the following Object:
let car = { year: 2004, type: {name: "BMW"} }
Now, I am trying to add a property to the inner object "type". My aim is to achieve this using the spread operator as I require a new object due to the existing one being an immutable state object. The desired result should look like this:
{ year: 2004, type: {name: "BMW", model: "3er"}}
What would be the best approach to accomplish this task?