- Open your command-line application and navigate to your workspace.
- Create a new folder named 07-07-static-methods-on-all-instances.
- Copy or create an index.html that loads and runs a main function from main.js.
- Create a main.js file with an empty object rocketMap and a class Rocket:
//main.jslet rocketMap = {}; class Rocket {}
- Create a static method named find that looks up rockets by string on the Rocket class:
class Rocket { // ... static find (name) { return rocketMap[name]; } }
- Add a construction that assigns a name property, and assigns the instance to the rocketMap:
class Rocket { // ... constructor(name) { this.name = name; rocketMap[name] = this; } }
- Create a main function that compares created instances ...