Synchronous code runs step by step where each step has to wait for previous one to be executed.
Example:
console.log("Hello Friends");
console.log("Hello");
console.log("Nice to meet you");
Here each line will execute then next until all finish.
But for asynchronous code it doesn't respect order stuff ,it get executed out of sequence.
Example:
console.log("Hello");
setTimeout(()=>console.log("Wait for 3 Second"),3000);
console.log("See you again");
First line will execute and last while for second one it has to wait for 3seconds to it will execute last.
I'm grateful that you took the time to read my writing, and I hope it will help you develop. Let's collaborate to brighten the future. All of my primary profiles are available on My Github
Top comments (0)