From 6e139cf3457782bf14729deabfa98d1aa96f21a1 Mon Sep 17 00:00:00 2001 From: Chhavi srivastav <77965216+chhavi48@users.noreply.github.com> Date: Sun, 18 Sep 2022 23:46:58 +0530 Subject: [PATCH] Create Synchronous_And_Asynchronus.md --- Notes/Synchronous_And_Asynchronus.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Notes/Synchronous_And_Asynchronus.md 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.

+ + +