Example JavaScript

async function main() {
  const output = document.getElementById('output');

  let url = 'https://swapi.co/api/people/3/';

  output.innerText = 'Fetching!';

  let response = await fetch(url)
    .catch((error) => {
      output.innerText = error;
    });
  
  output.innerText = response.statusText;
}

Output