Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/teotimepacreau/promises-and-asyncawait-exercices-day36-of-100daysofcode

Promises and AsyncAwait Exercices from #30daysofjavascript
https://github.com/teotimepacreau/promises-and-asyncawait-exercices-day36-of-100daysofcode

100daysofcode 30daysofjavascript async-await object-destructuring promises-in-javascript

Last synced: about 4 hours ago
JSON representation

Promises and AsyncAwait Exercices from #30daysofjavascript

Awesome Lists containing this project

README

        

# Promises and AsyncAwait Exercices from #30daysofjavascript
https://github.com/Asabeneh/30-Days-Of-JavaScript/blob/master/18_Day_Promises/18_day_promises.md

# Learned
- Promises are useful when performing a single asynchronous task
- Promises are based on `resolve and reject`, if it `resolves` the `.then` executes, if it `rejects` we `.catch` the error
- Some APIs already have in-built promises as the the fetch API allowing to directly use `.then` and `.catch`
- `Async/Await` : `async` make the function a promise, two blocks similar as `resolve` and `reject` : `try` and `catch`, we put the `await` in the `try` block, `await` allows to wait for the execution of a function before performing a task

# 🛠️
Vanilla Javascript