i need to compare a variable with multiple values
let test = 'e'
if(test == 'q' || test == 'w' || test == 'e') console.log('TEST')
Can you make this entry shorter?
I present it this way, but it is not correct.
let test = 'e'
if(test == 'q' || 'w' || 'e') console.log('TEST')
>Solution :
You can use an array:
const test = 'e'
if (['q', 'w', 'e'].includes(test)) {
console.log('TEST');
}