Skip to content Skip to sidebar Skip to footer

Or Operator Not Working In IF Statement Node.js

I originally had a route in node.js that stated this: If the req.url === something or something or something or something, do this, else, do that. The problem is that the else sta

Solution 1:

the else statement is never executed because your if condition always returns true..

if (category === 'stupid' || 'stupid2') {

the second part of the condition i.e. after the || operator is 'stupid2 which is a truthy value


Post a Comment for "Or Operator Not Working In IF Statement Node.js"