Last active
April 15, 2018 04:23
-
-
Save davidrhyswhite/84eb4f0295c402c5546a to your computer and use it in GitHub Desktop.
This file contains 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
const privateMethod = Symbol('privateMethod'); | |
export default class Service { | |
constructor () { | |
this.say = "Hello"; | |
} | |
[privateMethod] () { | |
console.log(this.say); | |
} | |
publicMethod () { | |
this[privateMethod]() | |
} | |
} | |
// Uncaught TypeError: (intermediate value).privateMethod is not a function | |
new Service().privateMethod() | |
// Uncaught TypeError: (intermediate value)[Symbol(...)] is not a function | |
new Service()[Symbol('privateMethod')](); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment