Last active
December 19, 2016 17:45
-
-
Save shotamatsuda/52b70edd4513edd8d034f2cd12d4bef9 to your computer and use it in GitHub Desktop.
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
class Multiplier { | |
constructor(value) { | |
const coefficient = value | |
return { | |
by(other) { | |
return other * coefficient | |
}, | |
} | |
} | |
// by(other) { | |
// There's no way to refer the coefficient if you don't want it to be | |
// exposed to public. Uncommenting here doen't matter because constructor | |
// in JS respects returned variable from it. | |
// } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment