Created
October 21, 2014 05:07
-
-
Save jwaltonmedia/510e77805bd8e7ee9403 to your computer and use it in GitHub Desktop.
Thoughts
This file contains hidden or 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
| //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