AJAX request success in JavaScript

The ok property contains true if a server responded with HTTP status from the 2xx group, and false if from another group:

public/client.jsbutton.addEventListener('click', function() {
  fetch('/ajax.html').then(response => {
    console.log(response.ok); // shows true or false
  });
});
Задание 1

Output a text of a page if the request was successful, and an error if a bad status was received.