Open KhalilKhunji opened 2 months ago
https://github.com/3liYusuf/js-objects-lab/blob/27bc3d2301bd3029c9d81608b81de9a5647c6b91/app.js#L384-L392
This problem is a classic case for using the .reduce method. Like so:
const pokemonTypes = pokemon.reduce((accumulator, poke) => { accumulator[poke.type] ? accumulator[poke.type].push(poke) : accumulator[poke.type] = [poke]; return accumulator; }, {});
Great job on this lab + Level up! Only real mistake was in the sorting, so nicely done!
Thank you Khalil for the great feedback!
https://github.com/3liYusuf/js-objects-lab/blob/27bc3d2301bd3029c9d81608b81de9a5647c6b91/app.js#L384-L392
This problem is a classic case for using the .reduce method. Like so:
Great job on this lab + Level up! Only real mistake was in the sorting, so nicely done!