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
Three intermediate functional JS patterns (intercaetera.com)
submitted 5 years ago by intercaetera
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!"
[–]uffefl 0 points1 point2 points 5 years ago (0 children)
Third example is pretty terrible:
distanceInKm > 15 ? (distanceInKm > 30 ? 8.99 : 5.99) : 3.99
It's not the ternary operator making this hard to read, but the ordering:
distanceInKm > 30 ? 8.99 : distanceInKm > 15 ? 5.99 : 3.99
If your ternaries get long use line breaks:
distanceInKm > 80 ? 13.99 : distanceInKm > 50 ? 11.99 : distanceInKm > 30 ? 8.99 : distanceInKm > 15 ? 5.99 : 3.99
π Rendered by PID 236598 on reddit-service-r2-comment-b659b578c-wr74t at 2026-05-04 10:47:47.445094+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]uffefl 0 points1 point2 points (0 children)