Skip to content

Instantly share code, notes, and snippets.

@gkatsev
Created May 27, 2013 22:11
Show Gist options
  • Save gkatsev/5659328 to your computer and use it in GitHub Desktop.
Save gkatsev/5659328 to your computer and use it in GitHub Desktop.
Object.create in JS.
var foo = {};
var bar = Object.create(foo);
var Foo = function() {};
var Bar = function(){
/* optional*/
Foo.apply(this, arguemnts);
};
Bar.prototype = Object.create(Foo.prototype);
Bar.prototype.constructor = Bar;
var Foo = function() {};
var foo = Object.create(Foo);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment