Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

multiple confition checking jasvascript

// A sometimes useful shorthand
if (value === 1 || value === 'one' || value === 2 || value === 'two') { }

// This achieves the same:
// Can be useful for long strings etc..
if ([1, 'one', 2, 'two'].indexOf(value) >= 0) { }
 
PREVIOUS NEXT
Tagged: #multiple #confition #checking #jasvascript
ADD COMMENT
Topic
Name
7+9 =