In ECMA2016 you can use the includes method. It’s the cleanest way I’ve seen. (Supported by all major browsers)
if([1,3,12].includes(foo)) {
// ...
}
In ECMA2016 you can use the includes method. It’s the cleanest way I’ve seen. (Supported by all major browsers)
if([1,3,12].includes(foo)) {
// ...
}