diff --git a/Notes/Synchronous_And_Asynchronus.md b/Notes/Synchronous_And_Asynchronus.md new file mode 100644 index 0000000..b262f2a --- /dev/null +++ b/Notes/Synchronous_And_Asynchronus.md @@ -0,0 +1,28 @@ +

Synchronous

+

Every Statement of code get executed one by one so basically a statement has to wait for earliar statement to get executed.

+

Example

+ + ``` + console.log("javascript"); + console.log("run"); + console.log("code"); + ``` +

It will print javascript first then run then code .

+ +

Asynchronous

+

It allow to program excuted immediatly without blocking the code unlike the synchronous method. it doesnot wait for earliear statment to get excuted first.

+

Each task excuted completed independly.

+ + ``` + console.log("javascript") + setTimeOut(()=>{ + console.log("run"); + 2000 + }) + console.log("code") + + ``` +

It will print javascript then code then run.

+ + +