'javascript enum to convert to list and check if the value is present in that enum
lets say i have an enum in javascript defined like this:
const myEnum = {
A:'a',
B:'b',
C:'c',
D:'d'
};
I have a character and I need to check whether it is present in the enum or not.
currently, I'm doing something like
if(value !== myEnum.A || value !==myEnum.B || ......) {
//FAILURE
}
this is something of a problem how do I make it something like:
if(value not in myEnum.values){
//FAILURE
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
