I’m new to javascript, it must be very basic:
if (controllerName === ('about' || 'contact' || 'lessons')) {
res.render(controllerName + '.ejs', locals);
}
Only when controllerName=='about' I go inside, the rest of the cases I don’t.
How do the or and === operate in this case ?
You structured it incorrectly. A fix would be
The problem was that
('about' || 'contact' || 'lessons')evaluates toaboutsince it is the first non-(null/undefined) value in the set. It seems like you want to comparecontrollerNameto all three values so notice how my version of your code comparescontrollerNameto all three values separately.