Question: javascript es6 5. Using Async/Awiait syntax that interact with the previous Promise functions that attempts to scrap websites for data. Write a function called asyncAwaitWebsiteScraps().

javascript es6

5. Using Async/Awiait syntax that interact with the previous Promise functions that attempts to scrap websites for data.

Write a function called asyncAwaitWebsiteScraps().

  • This function accepts one argument which is a website object.
  • This function uses the async/await syntax to interact with the previously written Promise functions openWebsitePromises() and scrapDataPromises()
  • This function should print to the console thesuccessanderrorsand handle both cases properly for async/await syntax.
    • Success should print: scrapped from . (see expected outputs below)
    • Error should print: is down. (see expected outputs below)
  • ONLY use the functions from Question #4 with asyncAwaitWebsiteScraps() . Do not write any additional supporting functions.
  • DoNOTuse a setTimeout() in this function.

EXAMPLES:

Example Argument passed into the asyncAwaitWebsiteScraps function:

const google = {

site: 'google.com',

dataSize: 1,

responseTime: 0

};

OUTPUT:

scrapped 1 mb from google.com.

Example Argument passed into the asyncAwaitWebsiteScraps function:

const redditt = {

site: 'redditt.com',

dataSize: 200,

responseTime: null

};

OUTPUT:

redditt.com is down.

Example Argument passed into the asyncAwaitWebsiteScraps function:

const github = {

site: 'github.com',

dataSize: 500,

responseTime: 50

};

OUTPUT:

scrapped 500 mb from github.com

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!