JAVASCRIPT Telegram 2408
CHALLENGE

function Animal(name) {
this.name = name;
}

Animal.prototype.speak = function() {
return `${this.name} makes a noise.`;
};

function Dog(name) {
Animal.call(this, name);
}

Dog.prototype = Object.create(Animal.prototype);
Dog.prototype.constructor = Dog;

Dog.prototype.speak = function() {
return `${this.name} barks.`;
};

const animal = new Animal('Rover');
const dog = new Dog('Rex');

console.log(dog instanceof Animal, dog.speak(), animal.speak(), Dog.prototype.isPrototypeOf(dog));
6👍1



tgoop.com/javascript/2408
Create:
Last Update:

CHALLENGE

function Animal(name) {
this.name = name;
}

Animal.prototype.speak = function() {
return `${this.name} makes a noise.`;
};

function Dog(name) {
Animal.call(this, name);
}

Dog.prototype = Object.create(Animal.prototype);
Dog.prototype.constructor = Dog;

Dog.prototype.speak = function() {
return `${this.name} barks.`;
};

const animal = new Animal('Rover');
const dog = new Dog('Rex');

console.log(dog instanceof Animal, dog.speak(), animal.speak(), Dog.prototype.isPrototypeOf(dog));

BY JavaScript


Share with your friend now:
tgoop.com/javascript/2408

View MORE
Open in Telegram


Telegram News

Date: |

Telegram is a leading cloud-based instant messages platform. It became popular in recent years for its privacy, speed, voice and video quality, and other unmatched features over its main competitor Whatsapp. Users are more open to new information on workdays rather than weekends. How to Create a Private or Public Channel on Telegram? Click “Save” ;
from us


Telegram JavaScript
FROM American