From 9d7fd71f390528657c8d1731324a4d53a7d68198 Mon Sep 17 00:00:00 2001 From: Joolanda <50619917+Joolanda@users.noreply.github.com> Date: Fri, 15 Nov 2019 15:18:54 +0100 Subject: [PATCH 1/9] reducing spec variables --- js/scripts.js | 90 +++++++++++++++++---------------------------------- 1 file changed, 29 insertions(+), 61 deletions(-) diff --git a/js/scripts.js b/js/scripts.js index fecec76..d29f93a 100644 --- a/js/scripts.js +++ b/js/scripts.js @@ -6,65 +6,33 @@ // This array will become the repository of Pokémon to display in myapplication var repository = [ - pokemonName, - pokemonHeight, - pokemonType, + { + pokemonName: 'Absol', + pokemonHeight: "3'11\"", + pokemonType: 'dark', + }; + + { + pokemonName:'Luxray', + pokemonHeight: "4'07\"", + pokemonType: 'electric', + }; + + { + pokemonName:'Pikachu', + pokemonHeight: "1'04\"", + pokemonType: 'electric', + }; + + { + pokemonName: 'Milotic', + pokemonHeight: "20'04\"", + pokemonType: 'water', + }; + + { + pokemonName:'Eevee', + pokemonHeight: "1'00\"", + pokemonType: 'normal', + } ]; - -// 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', -}; - -var luxray = { - pokemonName:'Luxray', - pokemonHeight: "4'07\"", - pokemonType: 'electric', -}; - -var pikachu = { - pokemonName:'Pikachu', - pokemonHeight: "1'04\"", - pokemonType: 'electric', -}; - -var milotic = { - pokemonName: 'Milotic', - pokemonHeight: "20'04\"", - pokemonType: 'water', -}; - -var eevee = { - pokemonName:'Eevee', - pokemonHeight: "1'00\"", - pokemonType: 'normal', -}; From 142bac01d987e4dc1db8b458543acb54d806805e Mon Sep 17 00:00:00 2001 From: Joolanda <50619917+Joolanda@users.noreply.github.com> Date: Mon, 18 Nov 2019 09:07:16 +0100 Subject: [PATCH 2/9] Update scripts.js --- js/scripts.js | 90 +++++++++++++++++++++++++++++++++------------------ 1 file changed, 58 insertions(+), 32 deletions(-) diff --git a/js/scripts.js b/js/scripts.js index d29f93a..593dc0b 100644 --- a/js/scripts.js +++ b/js/scripts.js @@ -4,35 +4,61 @@ * Date: 2019-11-11 */ - // This array will become the repository of Pokémon to display in myapplication -var repository = [ - { - pokemonName: 'Absol', - pokemonHeight: "3'11\"", - pokemonType: 'dark', - }; - - { - pokemonName:'Luxray', - pokemonHeight: "4'07\"", - pokemonType: 'electric', - }; - - { - pokemonName:'Pikachu', - pokemonHeight: "1'04\"", - pokemonType: 'electric', - }; - - { - pokemonName: 'Milotic', - pokemonHeight: "20'04\"", - pokemonType: 'water', - }; - - { - pokemonName:'Eevee', - pokemonHeight: "1'00\"", - pokemonType: 'normal', - } -]; + // 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\"", + ]; + + repository.push(pokemonName, pokemonType, pokemonHeight); + + // defining the pokemons without external input + var absol = { + pokemonName: 'Absol', + pokemonHeight: "3'11\"", + pokemonType: 'dark', + }; + + var luxray = { + pokemonName:'Luxray', + pokemonHeight: "4'07\"", + pokemonType: 'electric', + }; + + var pikachu = { + pokemonName:'Pikachu', + pokemonHeight: "1'04\"", + pokemonType: 'electric', + }; + + var milotic = { + pokemonName: 'Milotic', + pokemonHeight: "20'04\"", + pokemonType: 'water', + }; + + var eevee = { + pokemonName:'Eevee', + pokemonHeight: "1'00\"", + pokemonType: 'normal', + }; From 1132157af6383ac9c4ac3c37f03ff7b97dcd65f5 Mon Sep 17 00:00:00 2001 From: Joolanda <50619917+Joolanda@users.noreply.github.com> Date: Mon, 18 Nov 2019 09:23:02 +0100 Subject: [PATCH 3/9] adding for loop --- js/scripts.js | 33 +++------------------------------ 1 file changed, 3 insertions(+), 30 deletions(-) diff --git a/js/scripts.js b/js/scripts.js index 593dc0b..db8f53c 100644 --- a/js/scripts.js +++ b/js/scripts.js @@ -32,33 +32,6 @@ repository.push(pokemonName, pokemonType, pokemonHeight); - // defining the pokemons without external input - var absol = { - pokemonName: 'Absol', - pokemonHeight: "3'11\"", - pokemonType: 'dark', - }; - - var luxray = { - pokemonName:'Luxray', - pokemonHeight: "4'07\"", - pokemonType: 'electric', - }; - - var pikachu = { - pokemonName:'Pikachu', - pokemonHeight: "1'04\"", - pokemonType: 'electric', - }; - - var milotic = { - pokemonName: 'Milotic', - pokemonHeight: "20'04\"", - pokemonType: 'water', - }; - - var eevee = { - pokemonName:'Eevee', - pokemonHeight: "1'00\"", - pokemonType: 'normal', - }; + for (var i = 0; i < pokemonName.length; i++) { + document.write(pokemonName[i]); + } From ac852e6b15f04d2d343d61799bd91a1bfd8ecce1 Mon Sep 17 00:00:00 2001 From: Joolanda <50619917+Joolanda@users.noreply.github.com> Date: Mon, 18 Nov 2019 10:11:10 +0100 Subject: [PATCH 4/9] including empty repository --- index.html | 4 ++-- js/scripts.js | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 3a63bbc..d1b6bc1 100644 --- a/index.html +++ b/index.html @@ -12,7 +12,7 @@

Hello! I am Píkachu.

- Find me and other Pokémon's with this Pokédex List! + Find out more about me + other Pokémon's with this Pokédex List!

Search for a Pokémon
@@ -24,6 +24,6 @@

Hello! I am Píkachu.

LinkedIn - + diff --git a/js/scripts.js b/js/scripts.js index db8f53c..bc9e71c 100644 --- a/js/scripts.js +++ b/js/scripts.js @@ -4,6 +4,9 @@ * Date: 2019-11-11 */ + // This array will become the repository of Pokémon to display in myapplication +var repository = []; + // array of pokemon names var pokemonName = [ 'Absol', From 4ba7cbb1250059824c38f2f2fe126165b23f7c66 Mon Sep 17 00:00:00 2001 From: Joolanda <50619917+Joolanda@users.noreply.github.com> Date: Mon, 18 Nov 2019 10:35:01 +0100 Subject: [PATCH 5/9] preparing details list for later --- index.html | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index d1b6bc1..547105f 100644 --- a/index.html +++ b/index.html @@ -12,10 +12,26 @@

Hello! I am Píkachu.

- Find out more about me + other Pokémon's with this Pokédex List! + Find out more about me + other Pokémon's with this

- Search for a Pokémon
+
+

Pokemon List

+
+ +

+ +
+ Search for more Pokémons +
- + From 4dcde7a005ec9fac1acf0ab3f71d98b48366c030 Mon Sep 17 00:00:00 2001 From: Joolanda <50619917+Joolanda@users.noreply.github.com> Date: Mon, 18 Nov 2019 11:13:41 +0100 Subject: [PATCH 6/9] each pokemon new line --- index.html | 100 ++++++++++++++++++++++++++++---------------------- js/scripts.js | 2 +- 2 files changed, 58 insertions(+), 44 deletions(-) diff --git a/index.html b/index.html index 547105f..7cc9c59 100644 --- a/index.html +++ b/index.html @@ -1,45 +1,59 @@ - - - - - - - Pokedoki JS App - - -
-

Hello! I am Píkachu.

-

- Find out more about me + other Pokémon's with this -

-
-
-

Pokemon List

-
- -

- -
- Search for more Pokémons -
- - - - + + + + + + + + + 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 bc9e71c..93abfe5 100644 --- a/js/scripts.js +++ b/js/scripts.js @@ -36,5 +36,5 @@ var repository = []; repository.push(pokemonName, pokemonType, pokemonHeight); for (var i = 0; i < pokemonName.length; i++) { - document.write(pokemonName[i]); + document.write(pokemonName[i] + "
"); } From 124ba37bd3ebe011ce6b440e9caae44dc847f0ca Mon Sep 17 00:00:00 2001 From: Joolanda <50619917+Joolanda@users.noreply.github.com> Date: Mon, 18 Nov 2019 11:36:21 +0100 Subject: [PATCH 7/9] including pokemon height --- js/scripts.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/scripts.js b/js/scripts.js index 93abfe5..f72d0b8 100644 --- a/js/scripts.js +++ b/js/scripts.js @@ -36,5 +36,5 @@ var repository = []; repository.push(pokemonName, pokemonType, pokemonHeight); for (var i = 0; i < pokemonName.length; i++) { - document.write(pokemonName[i] + "
"); + document.write(pokemonName[i]+" "+"(" + pokemonHeight[i]+")"+"
"); } From 711d1ca01d39271137a07f62ddaf1ab80b3ee480 Mon Sep 17 00:00:00 2001 From: Joolanda <50619917+Joolanda@users.noreply.github.com> Date: Mon, 18 Nov 2019 16:23:43 +0100 Subject: [PATCH 8/9] trying to add condition within loop --- js/scripts.js | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/js/scripts.js b/js/scripts.js index f72d0b8..3469e83 100644 --- a/js/scripts.js +++ b/js/scripts.js @@ -26,15 +26,27 @@ var repository = []; // array of pokemon heights, use array of strings var pokemonHeight = [ - "3'11\"", - "4'07\"", - "1'04\"", - "20'04\"", - "1'00\"", + 1.2, + 1.4, + 0.4, + 6.2, + 0.3, ]; +for (var j = 0; j < pokemonHeight.length; j++) { +var e = pokemonHeight; + var result = e; + + if (pokemonHeight[j] > e[j]) { + result = 'big'; +} else { + result = 'little'; +} +} + repository.push(pokemonName, pokemonType, pokemonHeight); for (var i = 0; i < pokemonName.length; i++) { - document.write(pokemonName[i]+" "+"(" + pokemonHeight[i]+")"+"
"); + document.write(pokemonName[i]+" "+"(height: " + + pokemonHeight[i]+")" + " " + result + "
"); } From 82d3e6af4c257c30ddbfadf7375030016651638f Mon Sep 17 00:00:00 2001 From: Joolanda <50619917+Joolanda@users.noreply.github.com> Date: Wed, 20 Nov 2019 18:32:28 +0100 Subject: [PATCH 9/9] update task 1.3 script --- js/scripts.js | 113 +++++++++++++++++++++++++++----------------------- 1 file changed, 62 insertions(+), 51 deletions(-) diff --git a/js/scripts.js b/js/scripts.js index 3469e83..ac60913 100644 --- a/js/scripts.js +++ b/js/scripts.js @@ -1,52 +1,63 @@ /*! - * 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 = []; - - // 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 = [ - 1.2, - 1.4, - 0.4, - 6.2, - 0.3, - ]; - -for (var j = 0; j < pokemonHeight.length; j++) { -var e = pokemonHeight; - var result = e; - - if (pokemonHeight[j] > e[j]) { - result = 'big'; -} else { - result = 'little'; -} -} - - repository.push(pokemonName, pokemonType, pokemonHeight); - - for (var i = 0; i < pokemonName.length; i++) { - document.write(pokemonName[i]+" "+"(height: " + - pokemonHeight[i]+")" + " " + result + "
"); - } +* Here comes all Javascript +* Pokedoki App +* Date: 2019-11-11 +*/ + +// 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 + +var absol = { + name:'Absol', + height: 1.2, + type: 'dark', +}; + +var luxray = { + name:'Luxray', + height: 1.4, + type: 'electric', +}; + +var pikachu = { + name:'Pikachu', + height: 0.4, + type: 'electric', +}; + +var milotic = { + name: 'Milotic', + height: 6.2, + type: 'water', +}; + +var eevee = { + 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 + // ... +};