This lesson will explain the solution to the problem in the previous lesson.
class Vegetables { veggies() { return "Choose Veggies" }}class Meat { meat() { return "Choose Meat" }}class Sauces{ choosingSauces(){ return "Choose Sauces" }}function combineClasses(dest,...src){ for (let _dest of src) { for (var key of Object.getOwnPropertyNames(_dest.prototype)) { dest.prototype[key] = _dest.prototype[key] } }}class Burger{}//adding a new classclass Cheese{ addingCheese(){ return "Add Cheese" }}combineClasses(Burger,Vegetables,Meat,Sauces,Cheese)var burger = new Burger()console.log(burger.veggies())console.log(burger.meat())console.log(burger.choosingSauces())console.log(burger.addingCheese())
The challenge had the following requirements:
The methods of all classes should be available to the Burger class.
Burger
If any new classes are added, their methods should also be available to Burger class.
How do we ...