Put the lines of code in the correct order with indentation so that you get a getData function that takes as an argument the URL to be accessed and returns the data received using the fetch() request in the function.
Fetch API
async/await syntax
Report a typo
Reorder lines using drag or arrows. Adjust indentation with left buttons
const json = await response.json();
async function getData(url) {
const response = await fetch(url);
try {
return json;
}
console.log(error);
}
} catch (error) {
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.