function turtle(name, colour, weapon) {
// THIS is referencing the OBJECT
// kinda like ../ when changing a directory
// assign THIS OBJECT'S property to VALUE
// this.property = value;
this.name = name;
this.colour = colour;
this.weapon = weapon;
this.friends = [];
this.tellMeMore = function() {
return this.name + " likes to wear " + this.colour;
}
this.makeAFriend = function(friends) {
for (var friend in friends) {
this.friends.push(friends[friend]);
}
}
return "we made a mutant turtle!";
}
var human = function(humanName, hairColour, eyeColour, weight, skills) {
// THIS is referencing the OBJECT
// kinda like ../ when changing a directory
// assign THIS OBJECT'S property to VALUE
// this.property = value;
this.name = humanName;
this.hairColour = hairColour;
this.eyeColour = eyeColour;
this.weight = weight;
this.skills = skills;
this.yabber = function() {
return this.name + " weighs about " + this.weight;
}
return "YOU ARE A CLONING MACHINEEEEEEEEEEE!@!@!@1313";
}
Constructor reps!
02.../d03/your_name/constructor_reps.js