Skip to content

Instantly share code, notes, and snippets.

@muslemomar
Created October 25, 2022 12:00
Show Gist options
  • Save muslemomar/1ea8d8e908e940e15d63f9507a3c21df to your computer and use it in GitHub Desktop.
Save muslemomar/1ea8d8e908e940e15d63f9507a3c21df to your computer and use it in GitHub Desktop.

Promise Discussion Questions

  1. In your own words, what does asynchronous mean?
  2. In your own words, what is a promise?
  3. In your own words, why is it called a Promise?
  4. In your own words, why is it called await?
  5. Please read the common mistakes section of MDN here and summarize what the common mistakes are.
  6. Why would you use async/await over .then?
@daliaJR
Copy link

daliaJR commented Oct 27, 2022

Team: [Batoul El Mansour, Ruba alsoheil, Dalia Jaber, Yahia hasan, Mahnaz Nazir, Omar Deeb]

  1. Asynchronous allow us to run multiple task at the same time even when we have a long running program rather than having to wait until that task has finished. Once it's finished the program will present the results

  2. promise is an object which help in the representation of the eventual completion or failure of an "asynchronous " operation.
    3)like the name implies, it means the guarantee of getting a return from the function. there are three states which are pending, fulfilled, rejected.
    4)Because it waits for a promise and get its value
    5)the error is being logged to console when writing code for Node.js, it's common that modules you include in your project may have unhandled rejected promises, logged to the console by the Node.js runtime. 

  3. Async/Await is used to work with promises in asynchronous functions. It is basically syntactic sugar for promises. It is just a wrapper to restyle code and make promises easier to read and use

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment