Created
July 2, 2013 06:53
-
-
Save zachshallbetter/5907232 to your computer and use it in GitHub Desktop.
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
var Duck = function(){ | |
this.quack = function(){alert('Quaaaaaack!');}; | |
this.feathers = function(){alert('The duck has white and gray feathers.');}; | |
return this; | |
}; | |
var Person = function(){ | |
this.quack = function(){alert('The person imitates a duck.');}; | |
this.feathers = function(){alert('The person takes a feather from the ground and shows it.');}; | |
this.name = function(){alert('John Smith');}; | |
return this; | |
}; | |
var in_the_forest = function(duck){ | |
duck.quack(); | |
duck.feathers(); | |
}; | |
var game = function(){ | |
var donald = new Duck(); | |
var john = new Person(); | |
in_the_forest(donald); | |
in_the_forest(john); | |
}; | |
game(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment