Objects are assigned and copied by reference. In other words, a variable stores not the “object value”, but a “reference” (address in memory) for the value.
Does passing by reference make a copy?
In pass by reference (also called pass by address), a copy of the address of the actual parameter is stored.
Objects are assigned and copied by reference. In other words, a variable stores not the “object value”, but a “reference” (address in memory) for the value. So copying such a variable or passing it as a function argument copies that reference, not the object itself.
The Object.assign() method is used to copy the values of all enumerable own properties from one or more source objects to a target object.