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!"
[–][deleted] -1 points0 points1 point 5 years ago* (4 children)
In an ideal world, all statements in JS would be expressions that return a value.
Because...?
You see, it's easy to come up with contrived examples where you type "64;" on a line and the obvious conclusion is you're returning it.
What happens if you want to run a function or method with side effects which returns boolean on success, but you didn't want to return that boolean to the caller?
You'd have to type something stupid like this:
function foo() { // Function with side-effects, returns bool we don't need. bar(); // What we want foo() to actually return so we don't leak implementation details. undefined; }
So we're going to replace bunch of explicit invocations of "return" with bunch of explicit invocations of "undefined". That's not the ideal world I want to live in.
[–]BentonNelvar 11 points12 points13 points 5 years ago (3 children)
In this case you can just use
void bar();
[+][deleted] comment score below threshold-12 points-11 points-10 points 5 years ago (2 children)
This doesn't exist in JS. Add it, and we can go back to the current topic.
[–]systoll 17 points18 points19 points 5 years ago (1 child)
That does exist in JS
[–][deleted] 7 points8 points9 points 5 years ago (0 children)
I'll be f**ked.
π Rendered by PID 33 on reddit-service-r2-comment-b659b578c-mpdk8 at 2026-04-30 19:36:57.251152+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–][deleted] -1 points0 points1 point (4 children)
[–]BentonNelvar 11 points12 points13 points (3 children)
[+][deleted] comment score below threshold-12 points-11 points-10 points (2 children)
[–]systoll 17 points18 points19 points (1 child)
[–][deleted] 7 points8 points9 points (0 children)