The goal of this exercise is to get an introduction to Underscore.js.
Instructions:
Your job is to fill in each of the functions stubbed out in the pokemon.js
file so that they work. I've written Jasmine Tests for each of them besides "printAllPokemonNamesToConsole", which you will just have to check manually.
For the others, go through the underscore.js docs and write the code that makes the tests pass.
To check if the tests have passed, open up SpecRunner.html in your browser.
- I've namespaced all of the functions to
pokemon
aka they are encapsulated in apokemon
object insrc/pokemon.js
. - I've put all of the pokemon data in
src/data.js
file. You do not need to modify anything in this file! - You shouldn't have to use any "for" loops.
-
Add an event listener to the "Gotta Catch 'Em All!" button so that when you click on it, it creates a div with the class "pokeball" for each Pokemon Type.
-
When you click on the div for a particular Pokemon Type, it should display a list of all the Pokemon of that type in that div.
-
Peruse the underscore.js docs for other interesting / useful functions and figure out how they work.
-
When you have some free time, it's also worth checking out the annotated source code to see how the library works under the hood.