4 ms·
Even better is 'is-even'. It depends on 'is-odd' and this is the entire thing: var isOdd = require('is-odd'); module.exports = function isEven(i) {
by knd775 7y ago
Even better is 'is-even'. It depends on 'is-odd' and this is the entire thing:
var isOdd = require('is-odd');
module.exports = function isEven(i) {
return !isOdd(i);
};
- dingaling 7y agoWhat does it return for zero?
- tlrobinson 7y agoZero is even.
- rys 7y ago(Thankfully?) it gets that right