I\'m trying to get the largest image
, title
, short description
and url
of top stories from the NY Times API. Before I get
Have a look at this. I answered in your dupe but here is better
let html = [];
fetch('https://api.nytimes.com/svc/topstories/v2/science.json?api-key=yourApiKey')
.then((resp) => resp.json())
.then(function(data) {
data.results.forEach(res => {
html.push(`${res.title}
`);
})
document.getElementById("res").innerHTML = html.join("");
})