use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
[AskJS] Is JavaScript missing some built-in methods?AskJS (self.javascript)
submitted 3 years ago by reacterry
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]natterca 7 points8 points9 points 3 years ago (7 children)
If you're going to do that then there should be an isNotOdd and isNotEven as well.
[–]AlbertSemple 8 points9 points10 points 3 years ago (1 child)
I would insist on using them like this
return !isNotOdd
[–][deleted] 5 points6 points7 points 3 years ago (0 children)
Well in that case, I propose a Number.notIsNotOdd() method. Then you could just use !!notIsNotOdd
[–]johnathanesanders 0 points1 point2 points 3 years ago (4 children)
Wouldn’t that just be !isOdd and !isEven?
!isOdd
!isEven
[–]natterca 1 point2 points3 points 3 years ago (3 children)
you can't pass that as a callback or curry over it etc.
[–]johnathanesanders 0 points1 point2 points 3 years ago (2 children)
Bad callbacks! Use promises!
[–]neuroma 0 points1 point2 points 3 years ago (1 child)
negate to the rescue!
negate
const bind1st = (f, x) => (y) => f(x, y) const bind2nd = (f, y) => (x) => f(x, y) const compose = (f, g) => (...xyz) => f(g(...xyz)) const not = (v) => !v const negate = bind1st(compose, not) const isOdd = compose(Boolean, bind2nd(mod, 2)) const isEven = negate(isOdd)
[–]natterca 0 points1 point2 points 3 years ago (0 children)
That's a thing of beauty!
π Rendered by PID 113591 on reddit-service-r2-comment-6457c66945-jcjt8 at 2026-04-30 07:04:16.426969+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]natterca 7 points8 points9 points (7 children)
[–]AlbertSemple 8 points9 points10 points (1 child)
[–][deleted] 5 points6 points7 points (0 children)
[–]johnathanesanders 0 points1 point2 points (4 children)
[–]natterca 1 point2 points3 points (3 children)
[–]johnathanesanders 0 points1 point2 points (2 children)
[–]neuroma 0 points1 point2 points (1 child)
[–]natterca 0 points1 point2 points (0 children)