3 ms·
Wow, I hadn't heard about the is-odd/is-even/is-number thing. That's hilarious and awful. Reminds me of: https://github.com/jezen/is-thirteen https://github.c
by da_chicken 8y ago
Wow, I hadn't heard about the is-odd/is-even/is-number thing. That's hilarious and awful.
Reminds me of: https://github.com/jezen/is-thirteen https://github.com/jezen/is-thirteen
- stephenr 8y agoThe “best” part of it all is that apparently js engines have an internal optimisation for `foo % 2 === 0`, because it’s such a common thing. This clown was using a bit wise operation in `is-even` “because everyone already knows about % 2 === 0`, and thus was hurting performance (on top of whatever extra memory is used for the module, function call overhead etc)