ES 2015

Async / Await

Example - Fetch without and with async await.

A very short and simple example of the fetch API.

Wondering about the =>, check out the arrow functions, for more information about the response.map bit, check out the map array method.
fetch('https://jsonplaceholder.typicode.com/users')
  .then(response => response.json())
  .then(response => {
    response = response.map(response => response.name);
    document.querySelector("#simple_fetch_result").innerHTML = getRenderArray(response);
  });
And with async / await
const getUserNames = async (result) => {
  const response = await fetch('https://jsonplaceholder.typicode.com/users');
  const data = await response.json();
  const names = data.map(user => user.name);
  document.querySelector(result).innerHTML = getRenderArray(names);
}
getUserNames('#fetch_result');
RESULT