async/await syntax

Report a typo

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.

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) {
              
___

Create a free account to access the full topic