## Feedback
[Feedback Form](https://docs.google.com/forms/d/e/1FAIpQLSeGNFA9YYgP2Awz_2RnGm1RjdEDx-CWul6nTT5BQ4f7lDI4Ug/viewform?entry.1364471353=jid-part5-async&entry.1404187043&entry.1060203151&entry.936748505&entry.90248072)
## Notes
1. Sync vs Async
- JS executes code in a synchronous manner one function at a time one statement at a time
- JS is single threaded
- that means only one statement is executed at a time.
- Asynchronous mean two or more things happening at a time. In JS that means deferring remaining execution of a function
- We need this because some operation can take be very slow:
- image processing
- file operations I/O
- HTTP Request and waiting for response
- Sometimes making huge calculations can be kinda slow
- These types of operation on our Execution Stack `Block` further execution
2. CallBacks
- https://developer.mozilla.org/en-US/docs/Glossary/Callback_function
```
A callback function is a function passed into another function as an argument,
which is then invoked inside the outer function to complete some kind of routine or action.
```
3. Promises
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises
```
A Promise is an object representing the eventual completion or failure of an asynchronous operation.
```
4. Async/Await
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function
```
An async function can contain an await expression that pauses the execution of the async function
and waits for the passed Promise's resolution, and then resumes the async function's execution and
returns the resolved value. Remember, the await keyword is only valid inside async functions.
If you use it outside of an async function's body, you will get a SyntaxError.
```
5. Things we didn't cover related to ASYNC in JS
- Generators
- Observables
- (We'll get a course out on these two soon. Keep an eye out on the GroupSession channel in Slack)
6. Where to go from here
- https://github.com/getify/You-Dont-Know-JS/blob/master/async%20%26%20performance/README.md
- http://eloquentjavascript.net/
- https://kosamari.com/notes/the-promise-of-a-burger-party
## Demo Code