JavaScriptにおける同期スタイルのfetch

fetchを同期スタイルで扱うこともできます:

public/client.jsbutton.addEventListener('click', async function() {
  let response = await fetch('/ajax.html');
  let text = await response.text();
  console.log(text);
});
Задание 1

次のコードを同期スタイルで書き直してください:

javascriptbutton.addEventListener('click', function() {
  let promise = fetch('/ajax.html')
  .then(
    response => {
      if (response.ok) {
        return response.text();
      } else {
        throw new Error('応答ステータスが不正です');
      }
    },
  ).then(
    text => {
      console.log(text);
    }
  ).catch(
    error => {
      console.log(error);
    }
  );
});