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
// Constructor function. Code run by the "new" operator | |
var Rabbit = function(name) { | |
// All Rabbit instances have their own property "name" | |
this.name = name; | |
} | |
// All Rabbit instances can speak, of course! | |
Rabbit.prototype.speak = function(what) { | |
return this.name + " says: " + what; | |
} |