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. In the code above, we changed the value of the property 'b' in objCopy object to 89 and when we log the modified objCopy object in the console, the changes only apply to objCopy .
Use the member-access operator ( . ) between the object variable name and the member name. If the member is Shared, you do not need a variable to access it.
Simply use myObject['thing']
.
You could use:
myObject[propertyString] ;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With