Pokemon

From ProgZoo
Revision as of 19:08, 16 August 2022 by Andr3w (talk | contribs) (Created page with "You can use the api provided by https://pokeapi.co/ to provide data for this appication. Create a new folder with two files: index.html <!DOCTYPE html> <html> <head>...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

You can use the api provided by https://pokeapi.co/ to provide data for this appication.

Create a new folder with two files:

index.html

<!DOCTYPE html>
<html>
   <head>
       <script src="pokemon.js" defer></script>
   </head>
   <body>

Welcome to the Pokemon App

   </body>
</html>

pokemon.js

document.body.onload = async ()=>{
   let resp = await fetch("https://pokeapi.co/api/v2/pokemon/?limit=30");
   let data = await resp.json();
   document.getElementById('detail').innerHTML = data;
}