JS12 ClassNotes
JS12 ClassNotes
Synchronous means the code runs in a particular sequence of instructions given in the program.
Each instruction waits for the previous instruction to complete its execution.
Asynchronous
Due to synchronous programming, sometimes imp instructions get
blocked due to some previous instructions, which causes a delay in the UI.
Asynchronous code execution allows to execute next instructions
immediately and doesn't block the flow.
Callbacks
A callback is a function passed as an argument to another function.
Callback Hell
Callback Hell : Nested callbacks stacked below one another forming a pyramid structure.
(Pyramid of Doom)
await pauses the execution of its surrounding async function until the promise is settled.
IIFE : Immediately Invoked Function Expression
IIFE is a function that is called immediately as soon as it is defined.