Synchronous
Each line of code is executed one after other and next line is not executed until the previous one has completed
console.log("hi")
console.log("welcome")
Output
hi
welcome
Asynchronous
A task can be initiated and while waiting for to complete,other task can be proceed
It allows multiple task to run independently
console.log("task1")O
setTimeOut(()=>{
console.log("task2")
},2000);
console.log("task3")
Output
task1
task3
task2
Top comments (0)