Comment on page


function fetchData() {
// Use the Fetch API to make a GET request to a specific URL
.then((response) => {
// Check if the response was OK
if (!response.ok) {
// If not, throw an error
throw new Error('Network response was not OK');
// If the response was OK, parse the response as JSON
return response.json();
.then((data) => {
// Log the response
console.log('Response', data)
.catch((error) => {
// Log any network errors that occur
console.error('There has been a problem with your fetch operation:', error);