Skip to content

Instantly share code, notes, and snippets.

@bdkosher
Created September 3, 2014 19:59
Show Gist options
  • Save bdkosher/77f01e79cd4149a423b2 to your computer and use it in GitHub Desktop.
Save bdkosher/77f01e79cd4149a423b2 to your computer and use it in GitHub Desktop.
Douglas Crockford shares his "recipe" for creating objects in JavaScript ES6 now that he's abandoned from both 'new', 'Object.create', and prototypal inheritance. http://www.infoq.com/presentations/efficient-programming-language-es6
function constructor(spec) {
let {member} = spec,
{other} = other_constructor(spec),
method = function () {
// member, other, method
};
return Object.freeze({
method,
other
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment