Skip to content

Instantly share code, notes, and snippets.

@shotamatsuda
Last active December 19, 2016 17:45
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 shotamatsuda/52b70edd4513edd8d034f2cd12d4bef9 to your computer and use it in GitHub Desktop.
Save shotamatsuda/52b70edd4513edd8d034f2cd12d4bef9 to your computer and use it in GitHub Desktop.
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