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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started