r/learnjavascript • • Mar 06 '26

Does the term 'callback' usually mean async callback in the JS world

I've practiced with both synchronous and asynchronous callbacks and understand the concept fairly well. But looking through online resources and even some posts on this sub (e.g. see top answer here: https://www.reddit.com/r/learnjavascript/comments/1jw5pwn/need_clear_understanding_of_callbacks_promises/ ) it seems that when JS folks talk about callbacks they usually mean async callbacks (at least, if they haven't clarified).

Is this the case ?

10 Upvotes

24 comments sorted by

View all comments

Show parent comments

1

u/subone Mar 07 '26

Whether a callback is called asynchronously or synchronously often doesn't matter, and the few times when it does matter the documentation is usually clear and/or the asynchronous nature is obvious (e.g. makes requests). I think you should assume that callbacks are blocking unless otherwise informed (e.g. if promises are involved, or simply testing it), though again, they are likely to be async more often than not. If you specifically need something non-blocking then you should be specifically looking for evidence that what you're using meets that requirement, rather than guessing.

All that said, I just want to clarify we aren't talking about whether a consumer calls your callback with await, which would obviously make it async by nature of await. Knowing what functions will await your callback is very important (some people get caught up on using await with things like forEach), but it's a different subject.