Practice cloning and navigating objects
In this exercise, we are going to practice cloning an object and updating it.
It all begins with John’s Amazon order:
John has a wife called Jane.
Jane decides to also place an order. Here are the details:
Order Id: 6335
Customer Id: 456
Product Item Id: 3
Product Item Name: “Product C”
Product Price: 999
The task
Create a new order object for Jane based on John’s original order.
Since John and Jane share the same address, we want to keep those values. But we also don’t want to mutate John’s order, or have any shared objects/arrays between the two orders.
Write the code that results in Jane’s order object.