- Open your command line application and navigate to your workspace.
- Create a new folder named 08-08-using-mixins.
- Copy or create an index.html that loads and runs a main function from main.js.
- Create a main.js file that defines a new class named Rocket. In the constructor, extend the current instance with an object named Launcher:
// main.js class Rocket { constructor(name) { Object.assign(this, Launcher); this.name = name; } print() { console.log(this.name + ' is a rocket'); } }
- Create a class named InactiveRocket that extends the Rocket class and assigns an additional lastFlow property in the constructor:
// main.js class InactiveRocket extends Rocket { constructor(name, lastFlown) { super(name); this.lastFlown = lastFlown; ...