simple pokedex displayer in JS, HTML and CSS
In this project, we will be using the API at https://pokeapi.co/ to display the first generation of Pokemon. The display will show the Pokemon’s number, name, sprite/image, and type.
To get started, you can use the following code snippet to set up a basic Pokemon Pokedex display using JavaScript and the Pokeapi:
// Set the base URL for the Pokeapi
const baseUrl = 'https://pokeapi.co/api/v2'
// Function to get a list of Pokemon from the Pokeapi
async function getAllPokemon() {
try {
// Send a GET request to the Pokeapi to retrieve the list of Pokemon
const response = await fetch(`${baseUrl}/pokemon`)
const data = await response.json()
// Return the list of Pokemon
return data.results
} catch (error) {
console.error(error)
}
}