1function extend(object1, ...object2) {
2
3 let mergedObject = Object.assign(object1, ...object2);
4 console.log(mergedObject);
5
6 return mergedObject;
7}
1The extends keyword is used to create a child class of another class (parent). The child class inherits all the methods from another class. Inheritance is useful for code reusability: reuse properties and methods of an existing class when you create a new class.