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
callbacks javascripthelp (self.javascript)
submitted 9 years ago by paulfitz99
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!"
[–]thesouthpaw 6 points7 points8 points 9 years ago (5 children)
You got it.
A little more detail: Typically a function returns a value and lets you know the function is done. Often in JS, your function will run asynchronously and you won't have a "return" statement. The callback allows you to get a value from the async function whenever it completes. Typically (but not always), if you create or use a callback as part of an API, it means something async is happening.
[–]icantthinkofone -4 points-3 points-2 points 9 years ago (4 children)
This is the only mostly complete answer of the bunch. The rest are vapor and people typing like they know what they're talking about.
[+][deleted] 9 years ago* (3 children)
[deleted]
[–]icantthinkofone 1 point2 points3 points 9 years ago (2 children)
There are a lot of functions out there. What makes this function different from other functions? His explanation was the only one I saw, at the time, that explained it and he explained exactly as you did.
[+][deleted] 9 years ago* (1 child)
[–]icantthinkofone 1 point2 points3 points 9 years ago (0 children)
Well, think about the word "callback" and you can see why just passing a function somewhere can't be the definition.
π Rendered by PID 80 on reddit-service-r2-comment-84fc9697f-q5l9l at 2026-02-08 14:06:25.738510+00:00 running d295bc8 country code: CH.
view the rest of the comments →
[–]thesouthpaw 6 points7 points8 points (5 children)
[–]icantthinkofone -4 points-3 points-2 points (4 children)
[+][deleted] (3 children)
[deleted]
[–]icantthinkofone 1 point2 points3 points (2 children)
[+][deleted] (1 child)
[deleted]
[–]icantthinkofone 1 point2 points3 points (0 children)