Fetching HTML of a website is returning an error

Im trying to fetch the HTML of a website with the fetch() function but i can’t get it to work.

This is what I’ve seen being used but it doesnt seem to work for me:

fetch('website_here')
  .then(response => {
    if (!response.ok) {
      throw new Error('Network response was not ok ' + response.statusText);
    }
    return response.text();
  })
  .then(html => {
    console.log(html); // Logs the HTML content of the page
  })
  .catch(error => {
    console.error('There has been a problem with your fetch operation:', error);
  });

Im getting this error: There has been a problem with your fetch operation: Error: Network response was not ok