Add promises resources (#1753)

pull/1763/head
Joseph Olayanju 2 years ago committed by GitHub
parent c75c15ba13
commit 56a0d07c1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 18
      content/roadmaps/107-nodejs/content/104-nodejs-async-programming/102-promises.md

@ -1 +1,19 @@
# 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.
<ResourceGroupTitle>Free Content</ResourceGroupTitle>
<BadgeLink colorScheme='yellow' badgeText='Read' href='https://nodejs.dev/en/learn/understanding-javascript-promises/'>Understanding Javascript Promises</BadgeLink>
<BadgeLink colorScheme='yellow' badgeText='Read' href='https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise'>Promise Methods</BadgeLink>
<BadgeLink colorScheme='blue' badgeText='Read' href='https://www.promisejs.org/'>Official Website</BadgeLink>
<BadgeLink colorScheme='green' badgeText='Read' href='https://www.freecodecamp.org/news/javascript-promises-for-beginners/'>Official Website</BadgeLink>
<BadgeLink badgeText='Watch' href='https://www.youtube.com/watch?v=a_8nrslImo4/'>Asynchronous JavaScript - Promises</BadgeLink>

Loading…
Cancel
Save