Don't forget to call for help if you need it in your breakout rooms!
-
What does the
async
keyword do? -
What does the
await
keyword do? -
Convert this function to use async / await: ( https://repl.it/@khalidwilliams/2006M3-async-await-practice )
// https://api.adviceslip.com/ function getAdvice () { fetch('https://api.adviceslip.com/advice') .then(response => response.json()) .then(adviceSlip => console.log(adviceSlip.advice)) .catch(error => console.error(error)); } getAdvice();
-
Why would you mock a network request in a test?
-
At a high level, what steps are necessary to mock out a network request?
-
Other questions? Put them here: https://docs.google.com/document/d/1td50LnCOA8VbAVA0KlOjm31Ach6F5NEQCy4QxgZhmOA/edit#
Hint: Don't be afraid to look at documentation for any of these questions!
if i add async key word to a function say
it will return a Promise with Resolve and Reject which can be handled by .catch, .then, .finally
await keyword is used to block execution of code inside an async function say