function Animal(name) {
this.name = name
this.makeSound = (sound) => {
return sound
}
}
function Cat(name) {
Animal.call(this, name)
this.makeSound = () => {
return 'Meow'
}
}
function Dog(name) {
Animal.call(this, name)
this.makeSound = () => {
return 'Woof'
}
}
let fluffy = new Cat('Fluffy')
fluffy.makeSound()
let sheeba = new Dog('Sheeba')
sheeba.makeSound()
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.