Skip to content

Instantly share code, notes, and snippets.

@devdays
Created December 2, 2014 21:24
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Object JavaScript - Review
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