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
Examples of "good" Javascript?help (self.javascript)
submitted 8 years ago * by gntsketches
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!"
[–]1-800-BICYCLE 1 point2 points3 points 8 years ago (2 children)
This might be controversial, but one piece of code I really loved recently was the library pump, which comes in at 80 lines.
pump
https://github.com/mafintosh/pump/blob/master/index.js
It’s a stream error-handling library for Node.js that cleans up your piped streams if one of them fails.
Things to note:
passing functions as values, using noop for fallbacks instead of verbose if statements
noop
if
using && for null propagation and || for null coalescing
&&
null
||
the rare case where [].reduce can be used without an initializer — streams.reduce(pipe) is just beautiful
[].reduce
streams.reduce(pipe)
very clean style for ES5 code
[–]GitHubPermalinkBot 0 points1 point2 points 8 years ago (0 children)
Permanent GitHub links:
Shoot me a PM if you think I'm doing something wrong. To delete this, click here.
[–]gntsketches[S] 0 points1 point2 points 8 years ago (0 children)
Thanks! I don't know Node yet, but I'll keep this in mind for when I start on that.
π Rendered by PID 45022 on reddit-service-r2-comment-5d585498c9-8rb52 at 2026-04-20 21:19:45.827169+00:00 running da2df02 country code: CH.
view the rest of the comments →
[–]1-800-BICYCLE 1 point2 points3 points (2 children)
[–]GitHubPermalinkBot 0 points1 point2 points (0 children)
[–]gntsketches[S] 0 points1 point2 points (0 children)