Wait, so there's an entire package that just divides by 2 an
Tue Oct 12, 2021 4:57am

d tells you if the result has a remainder? (Or shoot, you can just look at the last bit. If 1, not even.) It would kinda make sense in C, where the package could handle different numbers and number types, but isn't a number in JS just a number? (Been a while since I've looked at JS.)

One area where you never want to roll your own is in dates. Do you remember that despite being divisible by 4, that the year 2000 was not a leap year because it was also evenly divisible by 400? Even worse is time zones and daylight saving time... ALWAYS use a library for that.

/Programming Perl/ or "The Camel Book" is one of those books. The authors rather enjoyed Lord of the Rings and threw in references wherever they could. Way better than reading a manual.

    • 32 million downloads: https://www.npmjs.com/package/is-even But in a rational sense, that's a good philosophy. These days, I find myself looking to see if someone already created a package or library online before attempting to reinvent the wheel myself. I think my first real experience wit... more
      • Wait, so there's an entire package that just divides by 2 an- Puckdropper, Tue Oct 12 2021 4:57am
        • It relies on another package called "is-odd". This is the entire code for "is-even" From: https://github.com/i-voted-for-trump/is-even/blob/master/index.js /*! * is-even * * Copyright (c) 2015, 2017, Jon Schlinkert. * Released under the MIT License. */ 'use strict'; ... more
  • Click here to receive daily updates
    "Forces act when not restrained" - Puckdropper