Skip to content

Instantly share code, notes, and snippets.

@stevencombs
Created September 22, 2013 21:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevencombs/6663860 to your computer and use it in GitHub Desktop.
Save stevencombs/6663860 to your computer and use it in GitHub Desktop.
// Javascript Getting Started with Programming
// A Codecademy Javascript (Constructors in Review - Rabbits) assignment
// Dr. Steven B. Combs, coding novice
// Define Rabbit adjective constructor
function Rabbit(adjective) {
this.adjective = adjective;
this.describeMyself = function() {
console.log("I am a " + this.adjective + " rabbit");
};
}
// Define adjective for all rabbits
var rabbit1 = new Rabbit ("fluffy");
var rabbit2 = new Rabbit ("happy");
var rabbit3 = new Rabbit ("sleepy");
// Call method to print each rabbit to console
rabbit1.describeMyself();
rabbit2.describeMyself();
rabbit3.describeMyself();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment