Skip to content

Instantly share code, notes, and snippets.

@zachshallbetter
Created July 2, 2013 06:53
Show Gist options
  • Save zachshallbetter/5907232 to your computer and use it in GitHub Desktop.
Save zachshallbetter/5907232 to your computer and use it in GitHub Desktop.
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