I make a request to 'https://pokeapi.co/api/v2/pokemon/${name}' to obtain the information of a specific pokemon, the problem is that the name must be the same otherwise it returns undefined, I need to filter many pokemons, for example: if I search for char it should return charmeleon and charizard, because they both have 'char'. How can I filter a lot of pokemons?
const params = {
headers: {
'Content-Type': 'application/json'
}
}
const searchPokemon = async name => {
const url = `https://pokeapi.co/api/v2/pokemon/${name}`
try {
const response = await fetch(url, params);
const result = await response.json();
return result;
} catch (error) {
console.log(error)
}
}