Skip to content

Instantly share code, notes, and snippets.

@jwaltonmedia
Created October 21, 2014 05:07
Show Gist options
  • Select an option

  • Save jwaltonmedia/510e77805bd8e7ee9403 to your computer and use it in GitHub Desktop.

Select an option

Save jwaltonmedia/510e77805bd8e7ee9403 to your computer and use it in GitHub Desktop.
Thoughts
//removes the need for 'this'
function constructor(spec) {
let {member} = spec,
{other} = other_constructor(spec),
method = function() {
//member, other, method
};
return Object.freeze({
method,
other
});
}
function car(spec) {
let make = spec.make,
model = spec.model,
features = car_addons(spec)
drive = function() {
if (features.contains_sport_package) {
//vroom vroom
} else {
//beep
}
}
return Object.freeze({
drive,
features,
make,
model
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment