Object.assign() method allows us to copy the values of all enumerable properties from one or more source objects to a target object. It takes in a target object as the first parameter and one or more source objects as subsequent parameters. The method then returns the modified target object.
To delete a property from an object, we can use the
delete keyword followed by the object name and the property name.
It is important to note that deleting a property removes the property completely from the object, including its value and any associated methods.
car object, add a new property called
color and set its value to
year property from the
Sign up to start coding
Already have an account?