Skip to content

Instantly share code, notes, and snippets.

@dmnsgn
Created October 6, 2014 16:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmnsgn/c9764801de08da3d848a to your computer and use it in GitHub Desktop.
Save dmnsgn/c9764801de08da3d848a to your computer and use it in GitHub Desktop.
Douglas Crockford's constructor as explained in his NordicJS 2014 talk.
function constructor(spec) {
let {member} = spec,
{other} = other_constructor(spec),
method = function () {
// member, other, method, spec...
};
return Object.freeze({
method,
other
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment