```javascript
let url = 'https://newsapi.org/v2/top-headlines?sources=hacker-news&apiKey=<YOUR API KEY GOES HERE>'
fetch(url)
.then((r) => { return r.json() })
.then(
(data) => {
let results = data.articles // get the array of results from the data object
let articlesList = document.createElement('ul') // create a new `<li>`
let body = document.querySelector('body') // attach to the `<body>` node of the DOM
body.appendChild(articlesList) // append the list to the body
results.map( (article) => { // loop through each article object in the array of articles
let article = document.createElement('li') // create a article item `<li>`
article.innerHTML = '<a href="' + article.href + '">' + article.title + '</a>' // add the link to each li with each article's title as the text and link as the href
articlesList.appendChild(article) // append each article to the `<ul>`
}
)
}
)
.catch(
(e) => { console.log(`An error occurred: ${e}`) }
)