Skip to content

Instantly share code, notes, and snippets.

@mr-pascal
Created June 6, 2022 07:53
Show Gist options
  • Save mr-pascal/ea9be81fca72138094307ae4fdba9058 to your computer and use it in GitHub Desktop.
Save mr-pascal/ea9be81fca72138094307ae4fdba9058 to your computer and use it in GitHub Desktop.
enum MyStringEnum {
HELLO = 'HELLO_VALUE',
WORLD = 'WORLD_VALUE'
}
const stringEnumKeys = Object.keys(MyStringEnum);
const stringEnumValues = Object.values(MyStringEnum);
console.log('Keys:');
// Output: [ 'HELLO', 'WORLD' ]
console.log(stringEnumKeys);
console.log('Values:');
// Output: [ 'HELLO_VALUE', 'WORLD_VALUE' ]
console.log(stringEnumValues);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment