Skip to content

Instantly share code, notes, and snippets.

@arturparkhisenko
Created January 26, 2019 01:23
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 arturparkhisenko/71e094607bee3cbe7824789de27639b7 to your computer and use it in GitHub Desktop.
Save arturparkhisenko/71e094607bee3cbe7824789de27639b7 to your computer and use it in GitHub Desktop.
js-enum.js
// 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