Example JavaScript

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

  let goodURL = 'https://swapi.co/api/people/3/',
      badURL  = 'https://swapi.co/people/3/';

  output.innerText = 'Fetching!';

  fetch(goodURL)
    .then(response => response.statusText)
    .catch(reason => reason)
    .then(message => {
      output.innerText = message;
    });
}

Output