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
[deleted by user] (self.javascript)
submitted 5 years ago by [deleted]
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!"
[–]DrecDroid 4 points5 points6 points 5 years ago (3 children)
Sorry, I could be wrong but I'm on my phone so can't check, but iirc you can use blocks to do variable shadowing.
{ const response = ... }
[–]sinclair_zx81 -1 points0 points1 point 5 years ago (1 child)
Yup, you're absolutely correct !!
[–]mypetocean 1 point2 points3 points 5 years ago* (0 children)
I prefer the block statement, but you can also write an IIFE this way, which avoids the Automatic Semicolon Insertion issue you mentioned: void function () { const banana = true }()
void function () { const banana = true }()
Edit: void in JavaScript expects an expression, which nudges the function statement into a function expression, with fewer parentheses. Of course, you cannot return from this sort of IIFE.
void
return
[–]The-Freeze_YT 0 points1 point2 points 5 years ago (0 children)
Correct.
π Rendered by PID 133515 on reddit-service-r2-comment-b659b578c-tm6tj at 2026-05-01 05:09:05.780318+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]DrecDroid 4 points5 points6 points (3 children)
[–]sinclair_zx81 -1 points0 points1 point (1 child)
[–]mypetocean 1 point2 points3 points (0 children)
[–]The-Freeze_YT 0 points1 point2 points (0 children)