Created
January 26, 2019 01:23
-
-
Save arturparkhisenko/71e094607bee3cbe7824789de27639b7 to your computer and use it in GitHub Desktop.
js-enum.js
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
// https://twitter.com/rauschma/status/1088778137452924929 | |
// TypeScript | |
enum Response { | |
No, | |
Yes | |
} | |
// JavaScript | |
const Response = Object.freeze({ | |
__proto__: null, | |
No: Symbol('No'), | |
Yes: Symbol('Yes') | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment