Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const listaPokemones = [
- {
- nombre: 'Pikachu',
- tipo: 'Eléctrico',
- nivel: 25,
- habilidades: ['Impactrueno', 'Rayo', 'Cola de Hierro']
- },
- {
- nombre: 'Charizard',
- tipo: 'Fuego/Volador',
- nivel: 50,
- habilidades: ['Lanzallamas', 'Giro Fuego', 'Aerochorro']
- },
- {
- nombre: 'Bulbasaur',
- tipo: 'Planta/Veneno',
- nivel: 10,
- habilidades: ['Látigo Cepa', 'Hoja Afilada', 'Rayo Solar']
- },
- ];
- function* generadorPokemones(listaPokemones) {
- for (let i = 0; i < listaPokemones.length; i++) {
- yield listaPokemones[i];
- }
- }
- const pokemones = generadorPokemones(listaPokemones)
- console.log(pokemones.next().value)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement