Simplify nested if/else with repeated results?
You could check with the result of the first check. This is an exclusive OR check. // typeof inverse === ‘boolean’ function handleDirection(src) { if (src === ‘left’ === inverse) { tracker–; } else { tracker++; } } The check evaluates the expression in this order (src === ‘left’) === inverse: src === ‘left’ === … Read more