// JavaScript Document
console.log("Hola mundo");

//const URL="https://api.thedogapi.com/v1/images/search";
async function mostrar() {
	try{
		const res = await fetch("https://api.thedogapi.com/v1/images/search");
		if(res.status===200){
			const data = await res.json();
			console.log(data);

			const img=document.querySelector("img");
			img.src=data[0].url
		}else{
			alert("Ocurrio un error");
		}
	}catch(error){
		console.log(error);
	}

}
mostrar();

const btn=document.querySelector("button");
btn.addEventListener('click',function(){
	mostrar()
	})
