With integer inputs, checking for null
or zero
value faster.
// commonly used approach if(x != 0) { // ... } // faster approach using omit operation if(x) { // 0 is False // other is True }
Coercing non-zero falsy values to zero with OR.
This works because the OR
operator returns the value of the second operand when the first operand is falsy.
integerExpectation = nonZeroFalsyValue || 0;