-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
31 lines (23 loc) · 760 Bytes
/
Copy pathscript.js
File metadata and controls
31 lines (23 loc) · 760 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const apiKey = "UMDQ2uXQXQ2KlPZZTqLcARchTYMueoZHrvi52wxF"
async function listaImagenes(){
try{
let fetchImagen = await fetch(`https://api.nasa.gov/planetary/apod?api_key=${apiKey}&start_date=2017-07-08&end_date=2017-07-16`)
let imagen = await fetchImagen.json()
console.log(imagen)
imagen.map(elemento => {
console.log(elemento)
const card = document.querySelector("[data-ul]");
const conteudo =
`<li class="card">
<img class="card__image" src="${elemento.url}" alt="bla">
<h3 class="card__title">${elemento.title}</h3>
</li>` ;
card.innerHTML = card.innerHTML + conteudo;
return card;
});
}
catch(error){
console.log(error)
}
}
listaImagenes()