Generation

generate functionSat, 12 Nov 2022

fetch pokemon api then store the data in an object

// This is an example of a function that fetches the Pokemon API and returns the data function fetchPokemon() { // The URL of the API you're fetching const url = 'https://pokeapi.co/api/v2/pokemon/12'; // Create a new variable `promise` with data fetching from `url` const promise = fetch(url); // Return the result of `promise` return promise; } // Call `fetchPokemon` and store the result in a variable `pokemon` const pokemon = fetchPokemon(); // Log the result of the variable `pokemon` console.log(pokemon);

Javascript
Generate More

Want to kickstart your project?Use the new AI Studio to create your code