If Num Equals Two

If Num Equals Two
javascript-memes, npm-memes, is-even-memes, bad-code-memes, code-quality-memes | ProgrammerHumor.io

Someone's literally writing an isEven() function from scratch by checking if a number equals 0, 1, 2, or 3 individually and returning true/false accordingly. The beauty here is the complete disregard for the modulo operator (num % 2 === 0) that every developer learns in week one.

The plot twist? Kenny's response pointing out that there's literally an NPM package called is-even for this. Because why write 4 lines of cursed if-statements when you can install a dependency that probably has 47 transitive dependencies? The JavaScript ecosystem in a nutshell: someone already packaged your bad idea, and it has 2 million weekly downloads.

Bonus points for coding this on an airplane like it's some urgent production hotfix that can't wait until landing. When the coding urge hits, altitude is just a number.

More Like This