Open DigitalPhoneme opened 1 month ago
I see what you're saying, but I'm not clearly seeing what the issue is. Looking at ex. 5:
59-64: creates an array of all types that pokemon can have 67-72: creates an array of all types currently in the party 76-84: creates an array of all types NOT in the party 88-92: selects 3 random type NOT in the party 96-104: iterates creating an array of all Pokemon of a type that COULD get added to the party, then adds ONE of them. It does this for each type that will be added to the party 106-109: creates an array of the names of all Pokemon in the party for the console.log() on 110
I could probably make it simpler if I dig into it, but the end result is a party of 4 Pokemon, each with a unique type. I can't use .concat()
the way I have it written, since it pushes the Pokemon into the party on 103
based on a random number instead of building, say, a newPokemonArray
and merging it with game.party
.
If I'm missing something you noticed, feel free to let me know.
https://github.com/mike-gustafson/js-objects-lab/blame/5c745045ac20b1cd05fcb9269b809714666df47e/app.js#L68
You’ve added Pokémon to your party, and it’s clear you’re exploring their different attributes. Remember, to add multiple Pokémon from the
pokemon
array to your party, you can use the.push()
method to add one at a time or.concat()
to add them all at once. For attributes like'type'
or'HP'
, keep in mind how each Pokémon's unique qualities might help your party. Keep experimenting—you’re doing awesome!