DEV Community

Discussion on: JavaScript: Reduce the number of conditional operators used in the expression

Collapse
 
teebot profile image
Thibaut Nguyen

Another way to group conditions is to group them in arrays where

for all conditions: [conditionsToCheck].every(x => x)

for at least one: [conditionsToCheck].some(x => x)

Collapse
 
kvharish profile image
K.V.Harish

Yes, we can use it.

More optimized way.