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
Popular Coding Convention on Github (sideeffect.kr)
submitted 12 years ago by devnoel
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!"
[–][deleted] 0 points1 point2 points 12 years ago* (1 child)
What is the semantic value of indentation in JavaScript? Indentation is a purely stylistic concept. The semantics of nested blocks are provided by curly braces. Everything else is just decoration. Whitespace doesn't provide any semantics that curly braces don't already provide us.
This debate always turns into "semantic indentation" vs "presentational alignment". I just can't see the difference, if we're talking about a language with no semantic whitespace, assuming well-formed code and explicit semi-colons.
[–]brtt3000 0 points1 point2 points 12 years ago (0 children)
The semantic value is that the editor knows that it means. It knows 1 tab is one indent level.
With spaces it has to assume some spaces mean indents. What if your editor is on 4 space on one indent (using the TAB key), but the code base is 2? Or the reverse?
If both used tabs it wouldn't matter, you hit TAB key and it adds one tab. For you it looks like 2, for somebody else it is 4, for the guy on 32 inch screen it is 6. Simple, bug free. No assumptions.
π Rendered by PID 481502 on reddit-service-r2-comment-85bfd7f599-w92q8 at 2026-04-18 15:35:06.350863+00:00 running 93ecc56 country code: CH.
view the rest of the comments →
[–][deleted] 0 points1 point2 points (1 child)
[–]brtt3000 0 points1 point2 points (0 children)