News for hackers. Stuff that matters.
Re:4B If Statements by christophilus on Thursday December 28, 2023 @09:36AM (#38793831)
I'd bet this is slower:

    function isEven(n) {
      let arr = [];
      let sign = -1;
      for (let i = 0; i < Math.abs(n); ++i) {
        arr = [...arr, sign];
        sign *= -1;
      }
      return arr.length === 0 || arr.reduce((a, b) => a + b) === 0;
    }
But I'm not going to test it, because I'm doing productive things on my computer right now, and don't want to OOM.

Sadly, the OP missed an opportunity to call his program "blazingly fast" [0].

[0] https://www.youtube.com/results?search_query=primagen+blazin...

There are no comments on this comment yet.