4 ms·
Please run simple code to verify accuracy before publishing it. The unary plus operator coerces undefined to NaN, not to zero as your article states. The unar
by trehalose 7y ago
Please run simple code to verify accuracy before publishing it.
The unary plus operator coerces undefined to NaN, not to zero as your article states.
The unary plus operator coerces NaN to NaN, not to zero as your article states. (Remember that NaN is already a number, despite its name.)
If you need to coerce any falsy value to 0, the simplest way is to use bitwise operators. If you want to do it the six character way, I guess use Math.imul