Created
July 17, 2017 16:59
-
-
Save vidjuheffex/decaffa99d08c59579cff312ae464b5e to your computer and use it in GitHub Desktop.
Modifications to main.js to have tests pass
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//################################################################### | |
// __ | |
// ____/ /___ ____ ______ | |
// / __ / __ \/ __ `/ ___/ | |
// / /_/ / /_/ / /_/ (__ ) | |
// \__,_/\____/\__, /____/ | |
// /____/ | |
// Dog Constructor & Prototype | |
var Dog = { | |
create(name, color, status, hungry, owner){ | |
var dog = Object.create(Dog.prototype); | |
dog.name = name; | |
dog.color = color; | |
dog.status = status; | |
dog.hungry = hungry; | |
dog.owner = owner; | |
return dog; | |
}, | |
prototype: { | |
} | |
}; | |
var Human = { | |
create(name, isCool){ | |
var human = Object.create(Human.prototype); | |
human.name = name; | |
human.cool = isCool; | |
return human; | |
}, | |
prototype: { | |
pet(dog){ | |
dog.status = "happy"; | |
}, | |
feed(dog){ | |
dog.hungry = false; | |
} | |
} | |
} | |
// Instances of Dog | |
// Needed: sadie, moonshine, atticus | |
// Instances of Human | |
// Needed: mason, julia | |
var sadie= Dog.create("sadie", "black", "normal", false, undefined); | |
var moonshine = Dog.create("moonshine", "brown", "normal", true, undefined); | |
var atticus = Dog.create("moonshine", "brown", "normal", true, undefined); | |
var mason=Human.create("mason", false); | |
var julia = Human.create("julia", true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment