We can use the spread operator
to insert the key-value pairs of an object
into another object.
In the example given above,
we are using the spread operator
to insert the key-value pairs from cat
into dog
.
In addition,
we can also add other key-value pairs to an object,
along with the spread operator,
as shown in the example below.
It is also possible to insert key-value pairs
from multiple objects at once,
using the spread operator.