From 56a0d07c1fd20e0cc50642bb12ebf12c71da767b Mon Sep 17 00:00:00 2001 From: Joseph Olayanju <49444453+Olayanju-1234@users.noreply.github.com> Date: Wed, 14 Sep 2022 11:20:37 +0100 Subject: [PATCH] Add promises resources (#1753) --- .../102-promises.md | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/content/roadmaps/107-nodejs/content/104-nodejs-async-programming/102-promises.md b/content/roadmaps/107-nodejs/content/104-nodejs-async-programming/102-promises.md index 0554eea0f..ad3532265 100644 --- a/content/roadmaps/107-nodejs/content/104-nodejs-async-programming/102-promises.md +++ b/content/roadmaps/107-nodejs/content/104-nodejs-async-programming/102-promises.md @@ -1 +1,19 @@ -# Promises \ No newline at end of file +# Promises + +A promise is commonly defined as a proxy for a value that will eventually become available +Asynchronous functions use promise behind the scens, so understanding how promises work is fundamental to understanding how "async" and "await" works. +Once a promise has been called, it will start in a pending state. This means that the calling function continues executing, while the promise is pending until it resolves, giving the calling function whatever data was being requested. + +Creating a Promise: +The Promise API exposes a Promise constructor, which you initialize using newPromise(). + +Using resolve() and reject(), we can communicate back to the caller what the resulting Promise state was, and what to do with it. + +Free Content + +Understanding Javascript Promises +Promise Methods +Official Website +Official Website +Asynchronous JavaScript - Promises +