I'm trying to learn es6 and playing around with the pokemon API. myRoute = 'https://pokeapi.co/api/v2/ability/144/';
const arrObservable = this._http.get(newurl);
arrObservable.subscribe(
(data) => {
const pokeString = data.pokemon.map( ( { pokemon }: obj ) => pokemon.name );
console.log(`There are ${data.pokemon.length} pokemon with the ${data.name} ability: ${pokeString}`);
})
output:
There are 19 pokemon with the regenerator ability: slowpoke,slowbro,tangela,slowking,corsola,ho-oh,tangrowth,audino,solosis,duosion,reuniclus,foongus,amoonguss,alomomola,mienfoo,mienshao,mareanie,toxapex,tornadus-therian
I am getting the correct results, it just looks a bit icky in the console, so I'm wondering if there is a way to add a '\n' every few lines while still using the .map() function?