To understand javascript you have to understand its single threaded nature. Imagin a chef in tiny kitchen with only single burner, that burner is the javascript engine and how the chef manage burner heat which determins either restaurant runs smoothly or ends up in a shouting match.
Content List
What synchronous code means
What Asynchronous Code Means
Why JavaScript Needs Asynchronous Behavior
Examples: Timers and API Calls
Problems with Blocking Code
What synchronous code means
Synchronous or sync is the default behaviour of the javascript, its a top to bottom, line by line execution of the code, in that each operaiton must be finish before next one starts.
Call Stack: a stack data structured by the js we called it call stack, it used to keep track what happening.…