Skip to content

Instantly share code, notes, and snippets.

@petermichaux
Created March 4, 2012 01:39
Show Gist options
  • Save petermichaux/1969805 to your computer and use it in GitHub Desktop.
Save petermichaux/1969805 to your computer and use it in GitHub Desktop.
// Instead of this
var bar = Object.create(foo);
extend(bar, {
sayGoodbye: function() { alert("goodbye from " + this.name); }
});
// why not write the following and provide a Object.create polyfill that supports the second argument?
var bar = Object.create(foo, {
sayGoodbye: function() { alert("goodbye from " + this.name); }
});
@Raynos
Copy link

Raynos commented Apr 14, 2012

Because the second parameter in your example is not a valid property descriptor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment