I’m wondering why this doesn’t work:
let num = 2;
let evenOrOdd = 'even';
console.log((num % 2) && (evenOrOdd == 'even'));
console.log(num % 2 && evenOrOdd == 'even');
CORRECTED CODE:
console.log(!(num % 2) && (evenOrOdd == 'even'));
I expected true, but I get false. Is there no way to evaluate two expressions surrounding a logical operator without first assigning those two expressions to separate variables? In other words: let condition1 = num % 2 && let condition2 = ‘even’