-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscript.js
22 lines (21 loc) · 948 Bytes
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
window.fetch("https://api.coinstats.app/public/v1/coins")
.then((response)=> response.json())
.then((data)=>cryptoDetails(data));
const cryptoDetails=(data)=>{
var coins=data.coins;
for(var i=0;i<100;i++){
console.log(coins[i].name);
const pElement=document.createElement('h1');
pElement.innerHTML="Rank : "+coins[i].rank+" - "+coins[i].name;
document.getElementById("root").appendChild(pElement);
const imageElement=document.createElement('img');
imageElement.src=coins[i].icon;
document.getElementById("root").appendChild(imageElement);
const price=document.createElement('p');
price.innerHTML="Price :" +coins[i].price;
document.getElementById("root").appendChild(price);
const contact=document.createElement('p');
contact.innerHTML="TwitterUrl :" +coins[i].twitterUrl;
document.getElementById("root").appendChild(contact);
}
};