After this lab, learners will have demonstrated the ability to:
- Create a class in JavaScript.
- Create class properties and methods.
- Use the class constructor to set class properties.
- Create instances of a class.
- Invoke class methods.
You will be working with these classes:
class Cat {}
class Pirate {
constructor() {
}
}
- Give the class at least three properties.
- Give the class at least three methods.
- Create two instances of the class (two cats).
- Log both instances to see their properties.
- Invoke each method from both instances.
- Create three properties that are set by the constructor.
- Create three methods.
- Instantiate two arrays of three pirates, name the arrays after your favorite pirate ships: jollyRoger and blackPearl.
- Loop over each array and print three properties of each pirate.