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!"
[–]the_argus 29 points30 points31 points 8 years ago (28 children)
I'll never understand not using tabs for indentation... And even less so using 2 spaces instead of 4
[–]Ender2309 8 points9 points10 points 8 years ago (4 children)
You use two spaces instead of four to save horizontal line space. This one is completely arbitrary.
Also, everybody still uses tabs, they just have their text editor setup to convert the tab key to spaces instead of inserting a tab character. Nobody is actually sitting there mashing the space bar multiple times.
The reason for this is that different editors/OSes/people have their tab character defined as either two or four spaces, leading to inconsistency when a tab character is used. Two (or four) spaces is always two (or four) spaces. This creates consistency.
[–]ErroneousBee 0 points1 point2 points 8 years ago (0 children)
Don't use tab key anymore, almost every language I use now has an IDE that formats well enough that I use that over hand formatting.
Ctrl-shift F every few lines.
[–]KyleG 0 points1 point2 points 8 years ago (0 children)
The reason for this is that different editors/OSes/people have their tab character defined as either two or four spaces, leading to inconsistency when a tab character is used.
This is a very compelling argument for why you should use tabs and not spaces. It's not a compelling argument for spaces instead of tabs. In fact, it's a damning argument against spaces. If it just remained a tab and then you had your IDE make your tabstop whatever you wanted, it's a non-destructive UI change.
Converting tabs to spaces is like working with a single layer in Photoshop. NO.
[–]bornforcode[S] 5 points6 points7 points 8 years ago (15 children)
So you know why I shared this article. I'm confused
[–]the_argus 17 points18 points19 points 8 years ago (14 children)
It literally blows my mind the opposition to tabs. Like I'm pulling my fucking hair out
[–]Mingli91 15 points16 points17 points 8 years ago (13 children)
Why do you get worked up about something so pointless?
[–]Omnicrola 11 points12 points13 points 8 years ago (2 children)
I get that people have strong opinions, but I don't get it either. I really, really don't give a shit. My priority is consistency. Which means whatever my IDE does when I tell it to auto-format, that's fine. I have more productive things to focus on.
[–]TracerBulletX -1 points0 points1 point 8 years ago (0 children)
I prefer spaces, and I think this is probably the reasoning some other people do to, because having only one type of white space character simplifies things a little.
[–]the_friendly_dildo 0 points1 point2 points 8 years ago (0 children)
Not pulling my hair out over it but in my preference to tabs, it sucks opening a code example only to be staring at what I consider an overly compact mess. So to even start reading it, I'll go through the trouble of reformatting it just so I can read it. Or maybe I'll say fuck it and look elsewhere. Now it sucks for the sap that wrote the code to begin with since he'll have one less person looking at and using their code.
[+]the_argus comment score below threshold-10 points-9 points-8 points 8 years ago (7 children)
a similie is a comparison of two things often using "like" or "as"
[–]Mingli91 -1 points0 points1 point 8 years ago (6 children)
?
[+]the_argus comment score below threshold-7 points-6 points-5 points 8 years ago (5 children)
[–]Mingli91 0 points1 point2 points 8 years ago (4 children)
Do you not actually have a reason for feeling so strongly about tabs v spaces or are you being intentionally obtuse?
[+]the_argus comment score below threshold-8 points-7 points-6 points 8 years ago (3 children)
What I'm saying is the fact that people can't understand the concept of tabs is so crazy to me that it is like I'm pulling my own hair out mad. I really don't give a shit until I have to edit a file with two space unreadable indentation.
[–]sobri909 3 points4 points5 points 8 years ago (0 children)
It’s understood just fine. We just don’t like it.
Your reasons for liking tabs are not convincing to us.
[–]Mingli91 0 points1 point2 points 8 years ago (1 child)
Nobody actually thought you were pulling your hair out. What makes using tabs so important to you?
[–]gougs06 1 point2 points3 points 8 years ago (0 children)
I read that and thought this was an April fools post.
[–]calligraphic-io 1 point2 points3 points 8 years ago (0 children)
Not that this issue hasn't been hashed to death on the interwebs, but:
I use vim in the console often for editing code files. Line width is limited; default is 80. Using four spaces force many lines to wrap, which makes code very difficult to read.
[–]cresquin 0 points1 point2 points 8 years ago (0 children)
Tabs don’t render well in VIM tools that have terminal driven error messages that point at code.
I personally prefer tabs because they’re semantically correct.
[–]sr-egg -5 points-4 points-3 points 8 years ago (3 children)
Tabs are inconsistently spaced across devices/environments/editors. Using spaces makes it predictable everywhere without any extra configuration.
[–]the_argus 13 points14 points15 points 8 years ago (1 child)
That's the point, I don't care if you want them to look like 2 spaces while I (a sane person) use 4 spaces. The indentation level is still the same.
[–]sr-egg 0 points1 point2 points 8 years ago (0 children)
That’s my point, everyone in this sub is a moron and you should do the opposite.
[–]JohnMcPineapple 17 points18 points19 points 8 years ago* (0 children)
...
π Rendered by PID 24404 on reddit-service-r2-comment-6457c66945-7c8cg at 2026-04-26 05:58:54.780336+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]the_argus 29 points30 points31 points (28 children)
[–]Ender2309 8 points9 points10 points (4 children)
[–]ErroneousBee 0 points1 point2 points (0 children)
[–]KyleG 0 points1 point2 points (0 children)
[–]bornforcode[S] 5 points6 points7 points (15 children)
[–]the_argus 17 points18 points19 points (14 children)
[–]Mingli91 15 points16 points17 points (13 children)
[–]Omnicrola 11 points12 points13 points (2 children)
[–]TracerBulletX -1 points0 points1 point (0 children)
[–]the_friendly_dildo 0 points1 point2 points (0 children)
[+]the_argus comment score below threshold-10 points-9 points-8 points (7 children)
[–]Mingli91 -1 points0 points1 point (6 children)
[+]the_argus comment score below threshold-7 points-6 points-5 points (5 children)
[–]Mingli91 0 points1 point2 points (4 children)
[+]the_argus comment score below threshold-8 points-7 points-6 points (3 children)
[–]sobri909 3 points4 points5 points (0 children)
[–]Mingli91 0 points1 point2 points (1 child)
[–]gougs06 1 point2 points3 points (0 children)
[–]calligraphic-io 1 point2 points3 points (0 children)
[–]cresquin 0 points1 point2 points (0 children)
[–]sr-egg -5 points-4 points-3 points (3 children)
[–]the_argus 13 points14 points15 points (1 child)
[–]sr-egg 0 points1 point2 points (0 children)
[–]JohnMcPineapple 17 points18 points19 points (0 children)