- Open your command-line application, and navigate to your workspace.
- Create a new folder named 12-08-create-class-to-wrap-set.
- Create a main.js file that defines a new class named Rocket that takes a constructor argument name and assigns it to an instance property:
// main.js class Rocket { constructor(name) { this.name = name; } }
- Create a class RocketSet file that creates a new map and assigns it as an instance property in the constructor:
// main.js class RocketSet { constructor () { this.set = new WeakSet(); } }
- Add an add method that checks the type of the key and value arguments. This method should throw if the argument types are incorrect; otherwise, set the pair as an entry on the map:
// main.js class RocketSet ...