Are these anons new? How can one not know about "isodd/is even/is number"?
We had lots of threads about this few months ago and almost every humour thread mentions it
Is the average programmer getting worse?
module.exports = function isOdd(value) {
const n = Math.abs(value);
if (!isNumber(n)) {
throw new TypeError('expected a number');
}
if (!Number.isInteger(n)) {
throw new Error('expected an integer');
}
if (!Number.isSafeInteger(n)) {
throw new Error('value exceeds maximum safe integer');
}
return (n % 2) === 1;
};
That's the whole thing. 3 million weekly downloads. This is why shit like the leftpad fuck-up happens.
Yes. Yes i am.
yes
>To reiterate, does JavaScript not have a modulus operator?
It does.
Oy gevalt.
A better question would be why does it have 7 versions and why do they need two people to come up with the code
OK
That many downloads because these functions are used by popular frameworks (it's a module or whatever JS calls imported libraries)
Apparently you need something like this because JS can be unpredictable. I think that's what author says.
He's a retard though, there was a screenshot from reddit where someone were laughing at him and he responded.
Anyway, lurk more
So, are people incapabe of using the mod operator? I mean... What the fuck?
We're hitting boomer levels that shouldn't even be possible!