Here's an example with two if conditions. The first if condition functions correctly, but the second if condition returns 11 unexpectedly. It's clear that the second if condition is incorrect, but it's worth exploring why JavaScript outputs 11 in this case.
function exception(number) {
// if(number === 10 || number === 11) { // Working as expected
if(number === 10 || 11) { // Why 11?
console.log(number);
}
}
function loop(f) {
for (i = 0; i <= 100; i++) {
f(i);
}
}
loop(exception);