Reduce multiple ORs in IF statement in Javascript

Posted by misha-moroshko on Stack Overflow See other posts from Stack Overflow or by misha-moroshko
Published on 2010-04-13T14:33:13Z Indexed on 2010/04/13 14:43 UTC
Read the original article Hit count: 183

Filed under:

Hello,

Is there a simpler way to rewrite the following condition in JavaScript ?

Thanks !

if ((x == 1) || (x == 3) || (x == 4) || (x == 17) || (x == 80)) {...}

© Stack Overflow or respective owner

Related posts about JavaScript