function async showUpdates() {
const json = await fetchJSON('http://google.com');
generateListFromData(json);
}
function async fetchJSON(url) {
const result = await ajax(url);
return JSON.parse(result);
}
function generateListFromData(data) {
const el = document.getElementById('js-results');
const elList = document.createElement('ul');
el.appendChild(elList);
data.forEach((item) => {
elList.appendChild(document.createElement('li').appendChild(item));
});
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.