Created
September 22, 2013 21:12
-
-
Save stevencombs/6663860 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
// 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