Is there a better way to write || in a single if statment [duplicate]

2

was wondering if there is a better way to write the code below. I want my if statement to ignore all of the keycodes. but seems quite a messy way to write it as below.

thanks!

if (event.keyCode === 9 
   || event.keyCode === 91 
   || event.keyCode === 20 
   || event.keyCode === 18 
   || event.keyCode === 17 
   || event.keyCode === 37)
Share
Improve this question
0

Comments

Popular posts from this blog

Meaning of `{}` for return expression

Get current scroll position of ScrollView in React Native

flutter websocket connection issue