diff --git a/index.html b/index.html index 3a63bbc..7cc9c59 100644 --- a/index.html +++ b/index.html @@ -1,29 +1,59 @@ - - - - - - - Pokedoki JS App - - -
-

Hello! I am Píkachu.

-

- Find me and other Pokémon's with this Pokédex List! -

- Search for a Pokémon -
- - - - + + + + + + + + + Pokedoki JS App + + + + + +
+

Hello! I am Píkachu.

+

+ Find out more about me + other creatures: +

+
+ +
+

Pokemon List

+
+ + + + + +

+ +
+ Search for more Pokémons +
+ + + + + + + + diff --git a/js/scripts.js b/js/scripts.js index fecec76..ac60913 100644 --- a/js/scripts.js +++ b/js/scripts.js @@ -1,70 +1,63 @@ /*! - * Here comes all Javascript - * Pokedoki App - * Date: 2019-11-11 - */ +* Here comes all Javascript +* Pokedoki App +* Date: 2019-11-11 +*/ - // This array will become the repository of Pokémon to display in myapplication -var repository = [ - pokemonName, - pokemonHeight, - pokemonType, -]; +// This array will become the repository of Pokémon to display in myapplication +const pokemon = []; +// add several objects (Pokémons)to the array. +// Each Pokémon needs to have the same keys to avoid errors -// array of pokemon names -var pokemonName = [ - 'Absol', - 'Luxray', - 'Pikachu', - 'Milotic', - 'Eevee', -]; - -// array of pokemon types, use array of strings -var pokemonType = [ - 'water', - 'electric', - 'dark', - 'normal' -]; - -// array of pokemon heights, use array of strings -var pokemonHeight = [ - "3'11\"", - "4'07\"", - "1'04\"", - "20'04\"", - "1'00\"", -]; - - -// defining the pokemons without external input var absol = { - pokemonName: 'Absol', - pokemonHeight: "3'11\"", - pokemonType: 'dark', + name:'Absol', + height: 1.2, + type: 'dark', }; var luxray = { - pokemonName:'Luxray', - pokemonHeight: "4'07\"", - pokemonType: 'electric', + name:'Luxray', + height: 1.4, + type: 'electric', }; var pikachu = { - pokemonName:'Pikachu', - pokemonHeight: "1'04\"", - pokemonType: 'electric', + name:'Pikachu', + height: 0.4, + type: 'electric', }; var milotic = { - pokemonName: 'Milotic', - pokemonHeight: "20'04\"", - pokemonType: 'water', + name: 'Milotic', + height: 6.2, + type: 'water', }; var eevee = { - pokemonName:'Eevee', - pokemonHeight: "1'00\"", - pokemonType: 'normal', + name:'Eevee', + height: 0.3, + type: 'normal', +}; + +pokemon.push(absol); +pokemon.push(luxray); +pokemon.push(pikachu); +pokemon.push(milotic); +pokemon.push(eevee); + + +//var biggest = " Wow,that\'s big!" +for (var i = 0; i < pokemon.length; i++){ + + var biggest = pokemon[i].height; + var result; + if (biggest <= 5) { + result = "\ "; + } else { + result = " Wow,that\'s big!"; + } + +document.write("
" + pokemon[i].name +" (" + "height: " +pokemon[i].height+")" + result + "
"); +// printing repository[i]’s other details + // ... };