Javascript callback functions are by default Synchronous or Asynchronous ?
Muhammad Hamza

Muhammad Hamza @hijazi313

About: A passionate self-taught full stack JavaScript developer.

Location:
Pakistan
Joined:
Jan 30, 2020

Javascript callback functions are by default Synchronous or Asynchronous ?

Publish Date: Mar 22 '21
0 2

Many times we pass callback functions to perform different tasks. In node.js these callback functions halp us to work Asynchronously but do they have the same impact in vanilla is code or anywhere else we use Javascript ?

Comments 2 total

  • robvirtuoso
    robvirtuosoApr 2, 2021

    In the browser, callbacks are mostly synchronous with the exception of:

    • event handlers
    • request-response handlers
    • timer callbacks (setTimeout, clearTimeout)

    But even in Node.js you have many synchronous callbacks, which you may not know as "callbacks". In particular, callbacks for iterating arrays, i.e. forEach, map, reduce.

Add comment