Skip to content

Instantly share code, notes, and snippets.

@jmarmolejos
Created December 6, 2015 15:24
Show Gist options
  • Select an option

  • Save jmarmolejos/b329fe857410048f019c to your computer and use it in GitHub Desktop.

Select an option

Save jmarmolejos/b329fe857410048f019c to your computer and use it in GitHub Desktop.
Foo.prototype = Object.create(shared);
Bar.prototype = Object.create(shared);
Foo.prototype.logHello = function() {
console.log("hello");
};
var objFoo = new Foo();
var objBar = new Bar();
objFoo.logHello(); // Logs "hello"
objBar.logHello(); // Errors out, as expected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment