This content originally appeared on DEV Community and was authored by Kavya S
What is Synchronous?
In synchronous,each line of code executes line by line.
that means,each line of code waits for the previous one to execute
Example:
console.log("Hi")
console.log("Welcome")
Output
Hi
Welcome
What is Asynchronous?
- In asynchronous,a task can be initiated and while waiting for it to complete, other task can be proceed.
- It improves performance
Example:
console.log("Task1")
setTimeOut(()=>{
console.log("Task2")
},2000);
console.log("Task3")
Output
Task1
Task3
Task2
This content originally appeared on DEV Community and was authored by Kavya S

Kavya S | Sciencx (2025-09-11T01:14:07+00:00) Synchronous,Asynchronous in JavaScript. Retrieved from https://www.scien.cx/2025/09/11/synchronousasynchronous-in-javascript/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.