Skip to content

Instantly share code, notes, and snippets.

@mrryanjohnston
Created June 19, 2011 19:48
Show Gist options
  • Save mrryanjohnston/1034654 to your computer and use it in GitHub Desktop.
Save mrryanjohnston/1034654 to your computer and use it in GitHub Desktop.
var Animal = function(sound) {
this.sound = sound
self = this
}
Animal.prototype.speak = function() {
console.log(self.sound)
}
var cat = new Animal('meow')
cat.speak()
setTimeout(cat.speak, 1000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment