This project is a simple Pokemon Pokedex web application that fetches Pokemon data from the PokeAPI and displays it on a webpage. The application utilizes JavaScript and the Fetch API to make asynchronous requests to the PokeAPI endpoint and dynamically generates Pokemon cards based on the retrieved data.
- Dynamically get the pokemon ID without specifying it in generatePokemonPromises
To use and run this project locally, follow the steps below:
-
Clone the Repository:
git clone https://github.com/vncsmnl/pokedex cd [repository_directory]
-
Open the HTML file: Open the
index.html
file in a web browser to view the Pokemon Pokedex.
-
Fetch Pokemon Data: The
fetchPokemon
function is responsible for making asynchronous requests to the PokeAPI to fetch data for a specific Pokemon. -
Generate Pokemon Card HTML: The
generatePokemonCardHTML
function takes Pokemon data as input and generates HTML markup for a Pokemon card, including its image, name, type, abilities, and stats. -
Insert Pokemon Cards Into Page: The
insertPokemonsIntoPage
function inserts the generated Pokemon cards into the specified HTML element with the attributedata-js="pokedex"
. -
Generate Pokemon Promises: The
generatePokemonPromises
function generates an array of promises, each corresponding to a Pokemon's data fetched from the PokeAPI. -
Update Pokedex: The
updatePokedex
function orchestrates the process of fetching Pokemon data for multiple Pokemon, generating HTML cards, and inserting them into the page.
- Open the
index.html
file in a web browser. - The Pokemon Pokedex will be dynamically populated with Pokemon cards, displaying information such as ID, name, type, abilities, and stats.
- This project relies on the Fetch API, which is available in modern web browsers.
- An active internet connection is required to fetch data from the PokeAPI.
Feel free to contribute to the project by opening issues or submitting pull requests.
This project is licensed under the MIT License.