Skip to content

Instantly share code, notes, and snippets.

@amelialaundy
Created June 22, 2014 01:48
Show Gist options
  • Save amelialaundy/eeb37ab3b0cbf5da82f2 to your computer and use it in GitHub Desktop.
Save amelialaundy/eeb37ab3b0cbf5da82f2 to your computer and use it in GitHub Desktop.
var Client = function(x,y,z,j){
this.name= x;
this.age= y;
this.quote= z;
this.showQuote = function() {
console.log(this.quote);
}
this.isFemale = j;
}
var adam = {
name: "Adam Sandler",
age:47,
quote: "That's your home! Are you too good for your home?!",
isFemale: false,
};
var kristen = {
name: "kristen Bell",
age:33,
quote: "Do you wanna build a snowman?",
isFemale: true,
}
var jim = {
name: "Jim Carrey",
age:52,
quote: "......So you're telling me there's a chance? YEAH!",
isFemale: false,
}
var shooterMcGavin = new Client("Shooter McGavin", 48, "Just stay out of my way... or you'll pay. Listen to what I say.", false);
console.log(shooterMcGavin["name"]);
console.log(shooterMcGavin.constructor === Client);
console.log(shooterMcGavin.age === 48);
console.log(shooterMcGavin.quote === "Just stay out of my way... or you'll pay. Listen to what I say.");
var showOff = function(x) {
console.log("Hi my name is" + " " + (x.name) + " and I am " + (x.age) + " years old. My favourite quote is " + (x.quote) + "." )
}
console.log(showOff(jim))
shooterMcGavin.showQuote()
var celebs = [adam, kristen, jim, shooterMcGavin]
var genderList = function() {
console.log("these are the male celebs we manage: ")
for (i=0; i<celebs.length;i++) {
if (celebs[i].isFemale === false) {
console.log(celebs[i].name);
}
}
}
console.log(celebs[0].name)
genderList()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment