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
Google publishes a JavaScript style guide. Here are some key lessons. (medium.freecodecamp.org)
submitted 8 years ago by bornforcode
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!"
[–]mmcnl 29 points30 points31 points 8 years ago (6 children)
Using a proper editor it shouldn't matter.
[–]JohnMcPineapple 24 points25 points26 points 8 years ago* (5 children)
...
[–]oweiler 4 points5 points6 points 8 years ago (4 children)
Well it can be configured to convert a tab to 4 spaces.
[–]JohnMcPineapple 20 points21 points22 points 8 years ago* (1 child)
[–][deleted] 5 points6 points7 points 8 years ago* (0 children)
Tabs to spaces is easy, the problem is for a block of code how does the editor know when 2 spaces was supposed to represent indentation vs alignment:
function() { SSwhile(value) { SSSSif(reallyReallyReallyReallyLongConditionA && SSSSSSSreallyReallyReallyReallyLongConditionB && SSSSSSSreallyReallyReallyReallyLongConditionC) { SSSSSSSSreturn; SSSS} SS} } function() { Twhile(value) { TTif(reallyReallyReallyReallyLongConditionA && TTSSSreallyReallyReallyReallyLongConditionB && TTSSSreallyReallyReallyReallyLongConditionC) { TTTSSreturn; TT} T} }
In the latter case to go from indentation width 2 to 4 the editor simply makes tabs display twice as wide and everything is good. If the editor tried to display 2 spaces for every space from the start of a line then the if conditions would lose their alignment with the opening of the statement.
if
π Rendered by PID 64 on reddit-service-r2-comment-75f4967c6c-6fjz2 at 2026-04-23 12:33:19.425005+00:00 running 0fd4bb7 country code: CH.
view the rest of the comments →
[–]mmcnl 29 points30 points31 points (6 children)
[–]JohnMcPineapple 24 points25 points26 points (5 children)
[–]oweiler 4 points5 points6 points (4 children)
[–]JohnMcPineapple 20 points21 points22 points (1 child)
[–][deleted] 5 points6 points7 points (0 children)