From 63a3fc300ed69e4eee5ea2bf4ff2bf37103d1f0e Mon Sep 17 00:00:00 2001 From: brightboost Date: Thu, 18 Nov 2021 21:28:41 +0100 Subject: [PATCH] concurrency event loop files --- Chapter 13/concurrency_chapter/eventloop-async.js | 7 +++++++ Chapter 13/concurrency_chapter/eventloop-sync.js | 6 ++++++ 2 files changed, 13 insertions(+) create mode 100644 Chapter 13/concurrency_chapter/eventloop-async.js create mode 100644 Chapter 13/concurrency_chapter/eventloop-sync.js diff --git a/Chapter 13/concurrency_chapter/eventloop-async.js b/Chapter 13/concurrency_chapter/eventloop-async.js new file mode 100644 index 0000000..19f97fe --- /dev/null +++ b/Chapter 13/concurrency_chapter/eventloop-async.js @@ -0,0 +1,7 @@ +console.log("Hi there"); +setTimeout(() => console.log("Sorry I'm late"), 1000); +console.log(add(4,5)); + +function add(x, y) { + return x + y; +} \ No newline at end of file diff --git a/Chapter 13/concurrency_chapter/eventloop-sync.js b/Chapter 13/concurrency_chapter/eventloop-sync.js new file mode 100644 index 0000000..f904d71 --- /dev/null +++ b/Chapter 13/concurrency_chapter/eventloop-sync.js @@ -0,0 +1,6 @@ +console.log("Hi there"); +add(4,5); + +function add(x, y) { + return x + y; +} \ No newline at end of file