How to do it...

  1. Open your command-line application and navigate to your workspace.
  2. Create a new folder named 09-01-defining-steps-with-template-functions.
  3. Copy or create an index.html file that loads and runs a main function from main.js.
  4. Create a main.js file that defines a new abstract class named Mission:
// main.js 
class Mission { 
  constructor () { 
    if (this.constructor === Mission) { 
      throw new Error('Mission is an abstract class, must       extend'); 
    } 
  } 
}  
  1. Add a function named execute that calls three instance methods—determineDestination, determinPayload, and launch:
// main.js 
class Mission { 
  execute () { 
    this.determinDestination(); 
    this.determinePayload(); 
    this.launch(); 
  } 
} 
  1. Create a LunarRover class that extends the Mission class: ...

Get ECMAScript Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.