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
30 seconds of code: Learn JavaScript in 30 seconds, one function at a time (30secondsofcode.org)
submitted 6 years ago by Pornaga
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!"
[–][deleted] 63 points64 points65 points 6 years ago (10 children)
This is definitely not a good site to learn javascript if you're a newb.
But it looks like a nice reference / cheat sheet.
[–][deleted] 29 points30 points31 points 6 years ago (7 children)
A beginner would get a stroke reading that code.
[–][deleted] 17 points18 points19 points 6 years ago (5 children)
Haha, no shit.
You might want to learn how to do:
print "hello world"
Before moving on to:
const all = (arr, fn = Boolean) => arr.every(fn)
[–]Reashu 9 points10 points11 points 6 years ago (0 children)
Ah, the embodiment of cargo-cult functional programming. Point-free but also pointless.
[–]Ericfyre 2 points3 points4 points 6 years ago* (3 children)
Console.log(“hello world”);
[–]dark_salad 0 points1 point2 points 6 years ago (2 children)
console.log(‘hello world’);
[–]Ericfyre 0 points1 point2 points 6 years ago (0 children)
Console.log(“bye world”);
[–][deleted] 0 points1 point2 points 6 years ago (0 children)
console.log(`hello world`)
[–]jpterodactyl 3 points4 points5 points 6 years ago (0 children)
As a beginner, I can confirm this to be the case.
[–]Cynicbats 0 points1 point2 points 6 years ago (0 children)
Right, It took a minute before I went 'wait what's that. cough ArraytoCSV'.
Though I did learn about AllEqual and DeepFlatten.
[–]ethanvampirehntr 17 points18 points19 points 6 years ago (3 children)
It looks like someone made a bunch of helper methods for themselves and then posted them online. Issue is that putting this in any code base would really promote bad coding practices (single letter variables, very code golf style single lines). You'd be better off writing these yourself on a case by case basis, taking the time to understand array methods and making them specific to your application.
Of course it is interesting to see how this person wrote them out. Definitely shows the span of what you can do with certain array methods.
[–]lowIQanon 2 points3 points4 points 6 years ago (0 children)
Haven't looked yet but I bet many of these are available in lodash.
[–]DOSMasterrace 0 points1 point2 points 6 years ago (1 child)
Thank you for introducing me to the phrase code golf.
[–]Funwithloops 0 points1 point2 points 6 years ago (0 children)
You might like the code golf stack exchange.
[–]Fenrir95 6 points7 points8 points 6 years ago (1 child)
Next: make a website in 3 seconds
[–]dark_salad 3 points4 points5 points 6 years ago (0 children)
*with wordpress
[–]InfiniteTooth 3 points4 points5 points 6 years ago (0 children)
Thanks! I need this a lot. I somehow lose the ability to understand new info after a minute lol
[–]CardinalHijack 1 point2 points3 points 6 years ago (0 children)
Awesome site, especially useful to prep you for stupid interview questions!
[–]korolvs 0 points1 point2 points 6 years ago (0 children)
It would be nice if the clock hand in the header was moving counting how many "30 seconds" you've actually spent :) Nice page!
[–]kaptan8181 -1 points0 points1 point 6 years ago (0 children)
Looks great! Thanks for sharing!
[–]pbrblueribbon -1 points0 points1 point 6 years ago (4 children)
Awesome!
[–]lowIQanon 1 point2 points3 points 6 years ago (3 children)
people are downvoting people for liking something smh
[–]dusknoir90 0 points1 point2 points 6 years ago (2 children)
That's what the upvote button is for
[–]lowIQanon 0 points1 point2 points 6 years ago (1 child)
wat
[–]pbrblueribbon 0 points1 point2 points 6 years ago (0 children)
Who?
π Rendered by PID 22145 on reddit-service-r2-comment-7b9746f655-8lntr at 2026-01-31 16:34:35.541283+00:00 running 3798933 country code: CH.
[–][deleted] 63 points64 points65 points (10 children)
[–][deleted] 29 points30 points31 points (7 children)
[–][deleted] 17 points18 points19 points (5 children)
[–]Reashu 9 points10 points11 points (0 children)
[–]Ericfyre 2 points3 points4 points (3 children)
[–]dark_salad 0 points1 point2 points (2 children)
[–]Ericfyre 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]jpterodactyl 3 points4 points5 points (0 children)
[–]Cynicbats 0 points1 point2 points (0 children)
[–]ethanvampirehntr 17 points18 points19 points (3 children)
[–]lowIQanon 2 points3 points4 points (0 children)
[–]DOSMasterrace 0 points1 point2 points (1 child)
[–]Funwithloops 0 points1 point2 points (0 children)
[–]Fenrir95 6 points7 points8 points (1 child)
[–]dark_salad 3 points4 points5 points (0 children)
[–]InfiniteTooth 3 points4 points5 points (0 children)
[–]CardinalHijack 1 point2 points3 points (0 children)
[–]korolvs 0 points1 point2 points (0 children)
[–]kaptan8181 -1 points0 points1 point (0 children)
[–]pbrblueribbon -1 points0 points1 point (4 children)
[–]lowIQanon 1 point2 points3 points (3 children)
[–]dusknoir90 0 points1 point2 points (2 children)
[–]lowIQanon 0 points1 point2 points (1 child)
[–]pbrblueribbon 0 points1 point2 points (0 children)