Created
September 3, 2014 19:59
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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