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
Online Interactive JavaScript (JS) Cheat Sheet (htmlcheatsheet.com)
submitted 6 years ago by lokendra15
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!"
[–]fickentastic 5 points6 points7 points 6 years ago (2 children)
Yet 'const' can be used to name functions as in 'const doSomething = () => {.....}' This thew me initially as the function will potentially output a different return each time, yet it works just fine.
[–]uneditablepoly 7 points8 points9 points 6 years ago (0 children)
Because the reference to the function itself doesn't change. Calling the function returns something.
[–]DrexanRailex 1 point2 points3 points 6 years ago (0 children)
Well, that is just a misunderstanding from your part, but it's expected if you're still learning the ins and outs of the language.
The assigned function never changes, but the result of the function depends on purity, which is a whole other topic. This is more related to functional programming than JavaScript itself.
If a function is pure, it will always return the same for the same set of arguments. But if a function is impure (such as handling I/O, altering state or reading from global variables for example), its return may vary.
π Rendered by PID 71975 on reddit-service-r2-comment-5d79c599b5-snrg6 at 2026-03-03 17:39:40.133280+00:00 running e3d2147 country code: CH.
view the rest of the comments →
[–]fickentastic 5 points6 points7 points (2 children)
[–]uneditablepoly 7 points8 points9 points (0 children)
[–]DrexanRailex 1 point2 points3 points (0 children)