Skip to content

Instantly share code, notes, and snippets.

@devdays
Created December 2, 2014 21:24
Show Gist options
  • Save devdays/1a3b0d5cd81919c0868c to your computer and use it in GitHub Desktop.
Save devdays/1a3b0d5cd81919c0868c to your computer and use it in GitHub Desktop.
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