Created
December 2, 2014 21:24
-
-
Save devdays/1a3b0d5cd81919c0868c to your computer and use it in GitHub Desktop.
Object JavaScript - Review
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
function Cat(name) { | |
this.name = name; | |
this.talk = function() { | |
console.log( this.name + " says meeow!" ); | |
} | |
} | |
var cat1 = new Cat("felix"); | |
cat1.talk(); //sends "felix says meeow!" to the console | |
var cat2 = new Cat("ginger"); | |
cat2.talk(); // sends "ginger says meeow!" to the console |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment