2 ms·
It is not just modulo, it also test for whether the input is a number or integer. It also has one dependency, is-number. And isOdd(“3”) returns true. Basically
by charlieyu1 3y ago
It is not just modulo, it also test for whether the input is a number or integer. It also has one dependency, is-number. And isOdd(“3”) returns true.
Basically it helps dealing with all the typing problems of Javascript, and also fitting into functional programming paradigms.
- ownlife 3y agoIf you need to know if a number is even or odd then you should convert it to an int natively anyway.