Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save MichaelEWalker87/c8f6282e54267d5e843a3b331189af28 to your computer and use it in GitHub Desktop.
Save MichaelEWalker87/c8f6282e54267d5e843a3b331189af28 to your computer and use it in GitHub Desktop.

Don't forget to call for help if you need it in your breakout rooms!

Warm Up

  • What does the async keyword do? it makes a function asyconous, where you would write the async in an es5 it goes in the front

  • What does the await keyword do? wait for the next thing to resolve you could use wait for alone wait for the promise to return a result only works with asyc functions could use on web api funtions

  • Convert this function to use async / await: ( https://repl.it/@khalidwilliams/2006M3-async-await-practice )

    // https://api.adviceslip.com/
    
    async function getAdvice () {
    	let resonpse = await fetch('https://api.adviceslip.com/advice')
    		if (!resopose.ok) {
            error => console.error(error)
            } else {
                return  await resonpse.blob();
            }
    
    }
    
    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!

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