.then/.catch methods

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 prints to the console the data received using the fetch() request in the function. Print the error message in the console if the request fails.

Reorder lines using drag or arrows. Adjust indentation with left buttons
                function getData(url){
              
                }
              
                .then((response) => response.json())
              
                fetch(url)
              
                .then((json) => console.log(json))
              
                .catch((error) => console.log(error.message))
              
___

Create a free account to access the full topic