Practice What You Learned
Intro
Now that you've learned about using classes in JavaScript to create objects, it's time for some practice!
Setup
Create a JavaScript
REPL
from repl.it -- you can name it "JavaScript Classes HW"
.`
Complete all work in your REPL.it
Then Submit The Link To Your REPL.it in Canvas
Creating Classes
You will be working with this class
class Cat {}
- give the class at least 3 properties
- give the class at least 3 methods
- create two instances of the class (two cats)
- log both instances to see their properties
- invoke each method from both instances
Constructors
here is a class to work with
class Pirate {
constructor(){
}
}
- create 3 properties that are set by the constructor
- create 3 methods
- instantiate
2 arrays
of3 pirates
, name the arrays after your favorite pirate ships, jollyRoger and blackPearl - loop over each array and print 3 properties of each pirate