Looking at their code, it’s really just a bunch of checks to make sure the variable passed is actually an integer that it can work with, followed by the solution:
return (n % 2) === 1;
I can’t think of a more efficient way to get the answer. It does seem like it’d take more time to download the package than to just write the function yourself, though.
Oh man, in js we have a package for this magic.
And it is so light, it only requires is-odd package!
That one is bad, I use this one https://www.npmjs.com/package/is-is-is-even
Why even do that, just check if this outputs false https://www.npmjs.com/package/is-is-is-is-is-is-odd
Oh fuck, gonna refactor asap!
I always forget if is even requires is odd or the other way around.
Weekly Downloads: 293.319
I would never touch js, so idk convention, but this has to be a joke right?
You’d think so but look at the number of active downloads 😅
Looking at their code, it’s really just a bunch of checks to make sure the variable passed is actually an integer that it can work with, followed by the solution:
return (n % 2) === 1;
I can’t think of a more efficient way to get the answer. It does seem like it’d take more time to download the package than to just write the function yourself, though.
Look at the downloads though!