//create teh Dog type
var Dog = function Dog(breed, sex, color, name, age) {
this.breed = breed;
this.sex = sex;
this.color = color;
this.name = name;
this.age = age;
};
//Setting up all the prototypes for my type
Dog.prototype.sayHello = function sayHello() {
console.log("Hello, I'm " + this.name);
};
Dog.prototype.myBreed = function myBreed() {
console.log("My breed is " + this.breed);
};
Dog.prototype.mySex = function mySex() {
console.log("I'm a " + this.sex +"!");
}
Dog.prototype.myColor = function myColor() {
console.log("Look at my beautiful " + this.color + " coat!")
};
Dog.prototype.myAge = function myAge() {
console.log("I'm " + this.age + " old")
}
//Declaring my different objects
var Kovu = new Dog("Pitbull", "boy", "black/white", "Kovu", "16 months");
var Riley = new Dog("Dobermann", "boy", "black/brown", "Riley", "2.5 years");
var Luna = new Dog("Peekapoo", "girl", "white", "Luna", "6 years");
//Calling the prototype methods I wrote
Kovu.sayHello();
Kovu.myBreed();
Kovu.mySex();
Kovu.myColor();
Kovu.myAge();
Riley.sayHello();
Riley.myBreed();
Riley.mySex();
Riley.myColor();
Riley.myAge();
Luna.sayHello();
Luna.myBreed();
Luna.mySex();
Luna.myColor();
Luna.myAge();
If you look in the console you will see all the outputs for the methods described
If you would like to see Riley and Kovu, click the following links:
Riley
Kovu