From e2d8f46cb14defe090c4d6e92c6c82611ce64183 Mon Sep 17 00:00:00 2001 From: abdullah <45887687+heartwhite@users.noreply.github.com> Date: Mon, 29 Apr 2019 00:15:18 +0200 Subject: [PATCH 01/19] abdullah github-username:heartwhite Javascript week1homework --- Week1/arrays.js | 8 ++++++ Week1/checkType.js | 48 +++++++++++++++++++++++++++++++++++ Week1/compairingInfinities.js | 13 ++++++++++ Week1/helloInDifLang.js | 1 + Week1/index.html | 24 ++++++++++++++++++ Week1/inlineQuote.js | 1 + Week1/numberRounding.js | 10 ++++++++ Week1/percentageCharacter.js | 16 ++++++++++++ Week1/stringtLenght.js | 4 +++ Week1/varXInteger.js | 7 +++++ Week1/varYString.js | 7 +++++ 11 files changed, 139 insertions(+) create mode 100644 Week1/arrays.js create mode 100644 Week1/checkType.js create mode 100644 Week1/compairingInfinities.js create mode 100644 Week1/helloInDifLang.js create mode 100644 Week1/index.html create mode 100644 Week1/inlineQuote.js create mode 100644 Week1/numberRounding.js create mode 100644 Week1/percentageCharacter.js create mode 100644 Week1/stringtLenght.js create mode 100644 Week1/varXInteger.js create mode 100644 Week1/varYString.js diff --git a/Week1/arrays.js b/Week1/arrays.js new file mode 100644 index 000000000..1e986ad1a --- /dev/null +++ b/Week1/arrays.js @@ -0,0 +1,8 @@ +//append arrays +let arraysInside = []; +console.log ('my array will contain: eagle, horse and dog'); +console.log(arraysInside); +let myFavoriteAnimals = ['eagle ', 'dog ', 'horse ']; +console.log(myFavoriteAnimals); +arraysInside = ['baby pig ' , myFavoriteAnimals]; +console.log(arraysInside); diff --git a/Week1/checkType.js b/Week1/checkType.js new file mode 100644 index 000000000..e48f81b1c --- /dev/null +++ b/Week1/checkType.js @@ -0,0 +1,48 @@ +//using the 'typeof' and compairing types with if statement +const myName = 'abdullah'; +let myAge = 33; +let myHobbies = ['swimming', 'coding', 'taking photographs']; +let iAmFunny = true; +let amIFunny = 'yes'; +console.log(myName); +console.log(myAge); +console.log(myHobbies); +console.log(iAmFunny); +console.log(amIFunny); +console.log('types of my variables are: string, number, array, boolean, string \(again\)'); +console.log(typeof myName); +console.log(typeof myAge); +console.log(typeof myHobbies); +console.log(typeof iAmFunny); +console.log(typeof amIFunny); + + +if(typeof myName === typeof myAge){ + console.log('SAME TYPE') +} else{ + console.log('NOT SAME TYPE') +} + +if(typeof myAge === typeof myHobbies){ + console.log('SAME TYPE') +} else{ + console.log('NOT SAME TYPE') +} + +if(typeof myHobbies === typeof iAmFunny){ + console.log('SAME TYPE') +} else{ + console.log('NOT SAME TYPE') +} + +if(typeof iAmFunny === typeof amIFunny){ + console.log('SAME TYPE') +} else{ + console.log('NOT SAME TYPE') +} + +if(typeof amIFunny === typeof myName){ + console.log('SAME TYPE') +} else{ + console.log('NOT SAME TYPE') +} \ No newline at end of file diff --git a/Week1/compairingInfinities.js b/Week1/compairingInfinities.js new file mode 100644 index 000000000..9f837adad --- /dev/null +++ b/Week1/compairingInfinities.js @@ -0,0 +1,13 @@ +// store diffrent types of data in one array, and compare the infinitives +let allTypesInsideArray = ['abdullah ', 33 , true] +console.log(allTypesInsideArray); + + +console.log('2 examples for compairing infinities') +if(6/0 === 10/0){ + console.log(true); +} else{ + console.log(false); +} + +console.log(6/0 == 10/0); \ No newline at end of file diff --git a/Week1/helloInDifLang.js b/Week1/helloInDifLang.js new file mode 100644 index 000000000..0fd6845fb --- /dev/null +++ b/Week1/helloInDifLang.js @@ -0,0 +1 @@ +console.log ('hello world ' + '\nздравствуйте мира ' + '\nmerhaba dunya'); \ No newline at end of file diff --git a/Week1/index.html b/Week1/index.html new file mode 100644 index 000000000..bbac991aa --- /dev/null +++ b/Week1/index.html @@ -0,0 +1,24 @@ + + + + + + + Hack Your Future + + +

Hello world!

+ + + + + + + + + + + + + \ No newline at end of file diff --git a/Week1/inlineQuote.js b/Week1/inlineQuote.js new file mode 100644 index 000000000..ec5ba25cf --- /dev/null +++ b/Week1/inlineQuote.js @@ -0,0 +1 @@ +console.log('I\'m awesome'); \ No newline at end of file diff --git a/Week1/numberRounding.js b/Week1/numberRounding.js new file mode 100644 index 000000000..64ff9b078 --- /dev/null +++ b/Week1/numberRounding.js @@ -0,0 +1,10 @@ +//round and compair numbers +let z = 7.25; +console.log(z); +let a = Math.round(z); +console.log(a); +let numbers = [a, z]; +numbers.sort(function(a, b) { return b - a; }); + +var highest = numbers[0]; +console.log(highest); diff --git a/Week1/percentageCharacter.js b/Week1/percentageCharacter.js new file mode 100644 index 000000000..d7eca0895 --- /dev/null +++ b/Week1/percentageCharacter.js @@ -0,0 +1,16 @@ +// using the '%' character +{let x = 7; +x = x % 3; + +console.log(x); + + +x = 7; +console.log('rest from 22/7 as integer is: '+ 22 % x); + +let xy = 74; +console.log('rest from 150/ \'value of xy\' as integer is: ' + 150 % xy); + +console.log('rest from \'value of xy\' / \'value of x\' as integer is: '+ xy % x); + +} \ No newline at end of file diff --git a/Week1/stringtLenght.js b/Week1/stringtLenght.js new file mode 100644 index 000000000..e4fbb33bf --- /dev/null +++ b/Week1/stringtLenght.js @@ -0,0 +1,4 @@ +// find length of string +let myString = "this is a test"; +console.log(myString); +console.log(myString.length); \ No newline at end of file diff --git a/Week1/varXInteger.js b/Week1/varXInteger.js new file mode 100644 index 000000000..dfb847fb6 --- /dev/null +++ b/Week1/varXInteger.js @@ -0,0 +1,7 @@ +//giving an integer value to variable x +let x; +console.log("the value of my variable x will be: my favorite number"); +console.log(x); +x = 775; +console.log("the value of x will be my favorite number: 775"); +console.log(x); \ No newline at end of file diff --git a/Week1/varYString.js b/Week1/varYString.js new file mode 100644 index 000000000..5b5781447 --- /dev/null +++ b/Week1/varYString.js @@ -0,0 +1,7 @@ +//giving a string value to variable y +let y = "everything is going well"; +console.log("the value of my string will be: everything is going well"); +console.log(y); +y = "actually everything is going on the best way"; +console.log("the value of my string will be: actually everything is going on the best way"); +console.log(y); From e8c149913c6f76c26bd5c39f0ef177f76258cc37 Mon Sep 17 00:00:00 2001 From: abdullah <45887687+heartwhite@users.noreply.github.com> Date: Thu, 2 May 2019 01:18:56 +0200 Subject: [PATCH 02/19] Update arrays.js up to Marcianos feedback. I used .push for adding --- Week1/arrays.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Week1/arrays.js b/Week1/arrays.js index 1e986ad1a..4a44ae919 100644 --- a/Week1/arrays.js +++ b/Week1/arrays.js @@ -1,8 +1,8 @@ //append arrays let arraysInside = []; -console.log ('my array will contain: eagle, horse and dog'); +console.log ('my array will contain some animals'); console.log(arraysInside); let myFavoriteAnimals = ['eagle ', 'dog ', 'horse ']; console.log(myFavoriteAnimals); -arraysInside = ['baby pig ' , myFavoriteAnimals]; +arraysInside.push('baby pig'); console.log(arraysInside); From 7955dcf8f451148be01f2dd020e655d0a1ee0551 Mon Sep 17 00:00:00 2001 From: abdullah <45887687+heartwhite@users.noreply.github.com> Date: Thu, 2 May 2019 01:19:48 +0200 Subject: [PATCH 03/19] Update checkType.js compared all variables at all angles --- Week1/checkType.js | 43 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/Week1/checkType.js b/Week1/checkType.js index e48f81b1c..ba723023c 100644 --- a/Week1/checkType.js +++ b/Week1/checkType.js @@ -23,26 +23,63 @@ if(typeof myName === typeof myAge){ console.log('NOT SAME TYPE') } +if(typeof myName === typeof myHobbies){ + console.log('SAME TYPE') +} else{ + console.log('NOT SAME TYPE') +} + +if(typeof myName === typeof iAmFunny){ + console.log('SAME TYPE') +} else{ + console.log('NOT SAME TYPE') +} + +if(typeof myName === typeof myAge){ + console.log('SAME TYPE') +} else{ + console.log('NOT SAME TYPE') +} + +if(typeof myName === typeof amIFunny){ + console.log('SAME TYPE') +} else{ + console.log('NOT SAME TYPE') +} + if(typeof myAge === typeof myHobbies){ console.log('SAME TYPE') } else{ console.log('NOT SAME TYPE') } +if(typeof myAge === typeof iAmFunny){ + console.log('SAME TYPE') +} else{ + console.log('NOT SAME TYPE') +} + +if(typeof myAge === typeof amIFunny){ + console.log('SAME TYPE') +} else{ + console.log('NOT SAME TYPE') +} + if(typeof myHobbies === typeof iAmFunny){ console.log('SAME TYPE') } else{ console.log('NOT SAME TYPE') } -if(typeof iAmFunny === typeof amIFunny){ +if(typeof myHobbies === typeof amIFunny){ console.log('SAME TYPE') } else{ console.log('NOT SAME TYPE') } -if(typeof amIFunny === typeof myName){ +if(typeof iAmFunny === typeof amIFunny){ console.log('SAME TYPE') } else{ console.log('NOT SAME TYPE') -} \ No newline at end of file +} + From ef957105a00a66065637084726d4a41bc34608ee Mon Sep 17 00:00:00 2001 From: abdullah <45887687+heartwhite@users.noreply.github.com> Date: Thu, 2 May 2019 01:20:54 +0200 Subject: [PATCH 04/19] Update compairingInfinities.js I took infinitives into Variables , than compared to make it more readable . --- Week1/compairingInfinities.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Week1/compairingInfinities.js b/Week1/compairingInfinities.js index 9f837adad..34d90f66d 100644 --- a/Week1/compairingInfinities.js +++ b/Week1/compairingInfinities.js @@ -1,13 +1,19 @@ // store diffrent types of data in one array, and compare the infinitives -let allTypesInsideArray = ['abdullah ', 33 , true] +let allTypesInsideArray = ['abdullah ', 33 , true]; console.log(allTypesInsideArray); console.log('2 examples for compairing infinities') -if(6/0 === 10/0){ +let infinitive1 = 6/0; +let infinitive2 = 10/0; +if(infinitive1 === infinitive2){ console.log(true); } else{ console.log(false); } -console.log(6/0 == 10/0); \ No newline at end of file +console.log(infinitive1 == infinitive2); + +/*in exercise of infinitives i used == and === both +because in this case i wanted to see each option. +i guess types are same but i just anted to see */ From 374834a44481fad5aa6bb35322e73b10c9ccd356 Mon Sep 17 00:00:00 2001 From: abdullah <45887687+heartwhite@users.noreply.github.com> Date: Thu, 2 May 2019 01:21:29 +0200 Subject: [PATCH 05/19] Update helloInDifLang.js console.log for each language --- Week1/helloInDifLang.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Week1/helloInDifLang.js b/Week1/helloInDifLang.js index 0fd6845fb..791046e23 100644 --- a/Week1/helloInDifLang.js +++ b/Week1/helloInDifLang.js @@ -1 +1,3 @@ -console.log ('hello world ' + '\nздравствуйте мира ' + '\nmerhaba dunya'); \ No newline at end of file +console.log ('hello world'); //english +console.log ('здравствуйте мира'); //russian +console.log('merhaba dunya'); //turkish From 5ee2deb1c86fe6b82beba0913b26b5b138cc9ca1 Mon Sep 17 00:00:00 2001 From: abdullah <45887687+heartwhite@users.noreply.github.com> Date: Thu, 2 May 2019 01:22:39 +0200 Subject: [PATCH 06/19] Update numberRounding.js changed calculating to Math.max to find highest. --- Week1/numberRounding.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Week1/numberRounding.js b/Week1/numberRounding.js index 64ff9b078..a32c6fdb1 100644 --- a/Week1/numberRounding.js +++ b/Week1/numberRounding.js @@ -4,7 +4,12 @@ console.log(z); let a = Math.round(z); console.log(a); let numbers = [a, z]; -numbers.sort(function(a, b) { return b - a; }); +let highNumber=(Math.max(z,a)); +console.log(highNumber); + +/* ----this is what i found first--- +numbers.sort(function(a, b) { return b - a; }); var highest = numbers[0]; -console.log(highest); +console.log(highest); +*/ From 92112f6b7a47c2f776c94d8b942fb13e475b3e71 Mon Sep 17 00:00:00 2001 From: abdullah <45887687+heartwhite@users.noreply.github.com> Date: Thu, 2 May 2019 01:23:09 +0200 Subject: [PATCH 07/19] Update varXInteger.js --- Week1/varXInteger.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Week1/varXInteger.js b/Week1/varXInteger.js index dfb847fb6..cbc72f7c5 100644 --- a/Week1/varXInteger.js +++ b/Week1/varXInteger.js @@ -1,7 +1,7 @@ //giving an integer value to variable x let x; -console.log("the value of my variable x will be: my favorite number"); +console.log("the value of my variable x will be: 775"); console.log(x); x = 775; -console.log("the value of x will be my favorite number: 775"); -console.log(x); \ No newline at end of file +console.log("the value of x will be: 775"); +console.log(x); From 2e3f3c194f944495e4f508eb7d2d754445450ff1 Mon Sep 17 00:00:00 2001 From: abdullah <45887687+heartwhite@users.noreply.github.com> Date: Thu, 2 May 2019 16:12:43 +0200 Subject: [PATCH 08/19] Update arrays.js .push chanced to myFavoriteAnimals variable --- Week1/arrays.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Week1/arrays.js b/Week1/arrays.js index 4a44ae919..124d0780e 100644 --- a/Week1/arrays.js +++ b/Week1/arrays.js @@ -4,5 +4,5 @@ console.log ('my array will contain some animals'); console.log(arraysInside); let myFavoriteAnimals = ['eagle ', 'dog ', 'horse ']; console.log(myFavoriteAnimals); -arraysInside.push('baby pig'); -console.log(arraysInside); +myFavoriteAnimals.push('baby pig'); +console.log(myFavoriteAnimals); From 8d5698967d6760be90ec06dd62d76609560c7ee3 Mon Sep 17 00:00:00 2001 From: abdullah <45887687+heartwhite@users.noreply.github.com> Date: Fri, 3 May 2019 23:53:56 +0200 Subject: [PATCH 09/19] Update MAKEME.md --- Week2/MAKEME.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Week2/MAKEME.md b/Week2/MAKEME.md index aa83c5bc4..9ca8ae250 100644 --- a/Week2/MAKEME.md +++ b/Week2/MAKEME.md @@ -1,4 +1,4 @@ -## Homework Week 2 +## Homework Week 2 ``` Topics discussed in class this week: From da68d90898220dbdb629f74639a04a12f4202a6a Mon Sep 17 00:00:00 2001 From: abdullah <45887687+heartwhite@users.noreply.github.com> Date: Mon, 6 May 2019 15:57:25 +0200 Subject: [PATCH 10/19] Update arrays.js --- Week1/arrays.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Week1/arrays.js b/Week1/arrays.js index 1e986ad1a..124d0780e 100644 --- a/Week1/arrays.js +++ b/Week1/arrays.js @@ -1,8 +1,8 @@ //append arrays let arraysInside = []; -console.log ('my array will contain: eagle, horse and dog'); +console.log ('my array will contain some animals'); console.log(arraysInside); let myFavoriteAnimals = ['eagle ', 'dog ', 'horse ']; console.log(myFavoriteAnimals); -arraysInside = ['baby pig ' , myFavoriteAnimals]; -console.log(arraysInside); +myFavoriteAnimals.push('baby pig'); +console.log(myFavoriteAnimals); From ed54c37967621d64c3f8365b0dbe608f904b21b8 Mon Sep 17 00:00:00 2001 From: abdullah <45887687+heartwhite@users.noreply.github.com> Date: Mon, 6 May 2019 15:58:03 +0200 Subject: [PATCH 11/19] Update checkType.js --- Week1/checkType.js | 43 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/Week1/checkType.js b/Week1/checkType.js index e48f81b1c..ba723023c 100644 --- a/Week1/checkType.js +++ b/Week1/checkType.js @@ -23,26 +23,63 @@ if(typeof myName === typeof myAge){ console.log('NOT SAME TYPE') } +if(typeof myName === typeof myHobbies){ + console.log('SAME TYPE') +} else{ + console.log('NOT SAME TYPE') +} + +if(typeof myName === typeof iAmFunny){ + console.log('SAME TYPE') +} else{ + console.log('NOT SAME TYPE') +} + +if(typeof myName === typeof myAge){ + console.log('SAME TYPE') +} else{ + console.log('NOT SAME TYPE') +} + +if(typeof myName === typeof amIFunny){ + console.log('SAME TYPE') +} else{ + console.log('NOT SAME TYPE') +} + if(typeof myAge === typeof myHobbies){ console.log('SAME TYPE') } else{ console.log('NOT SAME TYPE') } +if(typeof myAge === typeof iAmFunny){ + console.log('SAME TYPE') +} else{ + console.log('NOT SAME TYPE') +} + +if(typeof myAge === typeof amIFunny){ + console.log('SAME TYPE') +} else{ + console.log('NOT SAME TYPE') +} + if(typeof myHobbies === typeof iAmFunny){ console.log('SAME TYPE') } else{ console.log('NOT SAME TYPE') } -if(typeof iAmFunny === typeof amIFunny){ +if(typeof myHobbies === typeof amIFunny){ console.log('SAME TYPE') } else{ console.log('NOT SAME TYPE') } -if(typeof amIFunny === typeof myName){ +if(typeof iAmFunny === typeof amIFunny){ console.log('SAME TYPE') } else{ console.log('NOT SAME TYPE') -} \ No newline at end of file +} + From 915f56b2893f8d88f4646f527941104150eea35b Mon Sep 17 00:00:00 2001 From: abdullah <45887687+heartwhite@users.noreply.github.com> Date: Mon, 6 May 2019 15:58:29 +0200 Subject: [PATCH 12/19] Update compairingInfinities.js --- Week1/compairingInfinities.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Week1/compairingInfinities.js b/Week1/compairingInfinities.js index 9f837adad..34d90f66d 100644 --- a/Week1/compairingInfinities.js +++ b/Week1/compairingInfinities.js @@ -1,13 +1,19 @@ // store diffrent types of data in one array, and compare the infinitives -let allTypesInsideArray = ['abdullah ', 33 , true] +let allTypesInsideArray = ['abdullah ', 33 , true]; console.log(allTypesInsideArray); console.log('2 examples for compairing infinities') -if(6/0 === 10/0){ +let infinitive1 = 6/0; +let infinitive2 = 10/0; +if(infinitive1 === infinitive2){ console.log(true); } else{ console.log(false); } -console.log(6/0 == 10/0); \ No newline at end of file +console.log(infinitive1 == infinitive2); + +/*in exercise of infinitives i used == and === both +because in this case i wanted to see each option. +i guess types are same but i just anted to see */ From 3479de73e2e9d679d524f7bf8f42b36bdaa6b50d Mon Sep 17 00:00:00 2001 From: abdullah <45887687+heartwhite@users.noreply.github.com> Date: Mon, 6 May 2019 15:58:58 +0200 Subject: [PATCH 13/19] Update helloInDifLang.js --- Week1/helloInDifLang.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Week1/helloInDifLang.js b/Week1/helloInDifLang.js index 0fd6845fb..791046e23 100644 --- a/Week1/helloInDifLang.js +++ b/Week1/helloInDifLang.js @@ -1 +1,3 @@ -console.log ('hello world ' + '\nздравствуйте мира ' + '\nmerhaba dunya'); \ No newline at end of file +console.log ('hello world'); //english +console.log ('здравствуйте мира'); //russian +console.log('merhaba dunya'); //turkish From bf3fd0965e606d0879791b62feefbeb59316da7f Mon Sep 17 00:00:00 2001 From: abdullah <45887687+heartwhite@users.noreply.github.com> Date: Mon, 6 May 2019 15:59:50 +0200 Subject: [PATCH 14/19] Update numberRounding.js --- Week1/numberRounding.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Week1/numberRounding.js b/Week1/numberRounding.js index 64ff9b078..a32c6fdb1 100644 --- a/Week1/numberRounding.js +++ b/Week1/numberRounding.js @@ -4,7 +4,12 @@ console.log(z); let a = Math.round(z); console.log(a); let numbers = [a, z]; -numbers.sort(function(a, b) { return b - a; }); +let highNumber=(Math.max(z,a)); +console.log(highNumber); + +/* ----this is what i found first--- +numbers.sort(function(a, b) { return b - a; }); var highest = numbers[0]; -console.log(highest); +console.log(highest); +*/ From 49ed56e12ad18015dca344e30b1c8d197efef4c5 Mon Sep 17 00:00:00 2001 From: abdullah <45887687+heartwhite@users.noreply.github.com> Date: Tue, 14 May 2019 20:26:51 +0200 Subject: [PATCH 15/19] Abdullah JS week 3 index.html and 19 js files for steps of homework --- Week3/arrays.js | 10 ++++++++++ Week3/index.html | 40 ++++++++++++++++++++++++++++++++++++++++ Week3/moreJs-1.js | 4 ++++ Week3/moreJs-10.js | 26 ++++++++++++++++++++++++++ Week3/moreJs-11.js | 31 +++++++++++++++++++++++++++++++ Week3/moreJs-12.js | 1 + Week3/moreJs-13.js | 9 +++++++++ Week3/moreJs-14.js | 2 ++ Week3/moreJs-15.js | 24 ++++++++++++++++++++++++ Week3/moreJs-16.js | 16 ++++++++++++++++ Week3/moreJs-17.js | 6 ++++++ Week3/moreJs-2.js | 5 +++++ Week3/moreJs-3.js | 11 +++++++++++ Week3/moreJs-4.js | 12 ++++++++++++ Week3/moreJs-5.js | 14 ++++++++++++++ Week3/moreJs-6.js | 19 +++++++++++++++++++ Week3/moreJs-7and8.js | 9 +++++++++ Week3/moreJs-9.js | 20 ++++++++++++++++++++ Week3/strings.js | 6 ++++++ 19 files changed, 265 insertions(+) create mode 100644 Week3/arrays.js create mode 100644 Week3/index.html create mode 100644 Week3/moreJs-1.js create mode 100644 Week3/moreJs-10.js create mode 100644 Week3/moreJs-11.js create mode 100644 Week3/moreJs-12.js create mode 100644 Week3/moreJs-13.js create mode 100644 Week3/moreJs-14.js create mode 100644 Week3/moreJs-15.js create mode 100644 Week3/moreJs-16.js create mode 100644 Week3/moreJs-17.js create mode 100644 Week3/moreJs-2.js create mode 100644 Week3/moreJs-3.js create mode 100644 Week3/moreJs-4.js create mode 100644 Week3/moreJs-5.js create mode 100644 Week3/moreJs-6.js create mode 100644 Week3/moreJs-7and8.js create mode 100644 Week3/moreJs-9.js create mode 100644 Week3/strings.js diff --git a/Week3/arrays.js b/Week3/arrays.js new file mode 100644 index 000000000..d87833aaa --- /dev/null +++ b/Week3/arrays.js @@ -0,0 +1,10 @@ +let favoriteAnimals = ["blowfish", "capricorn", "giraffe"]; +favoriteAnimals.push('turtle'); +console.log(favoriteAnimals); +favoriteAnimals.splice(1 , 0 , 'meerkat'); +console.log('the value of favoriteAnimals will be: ["blowfish", "meerkat", "capricorn", "giraffe", "turtle"]'); +console.log(favoriteAnimals); +console.log('The array has a length of: ' + favoriteAnimals.length); +favoriteAnimals.splice(3 , 1 ,); +console.log(favoriteAnimals); +console.log('The item you are looking for is at index: '+favoriteAnimals.indexOf('meerkat')) \ No newline at end of file diff --git a/Week3/index.html b/Week3/index.html new file mode 100644 index 000000000..2e96663bb --- /dev/null +++ b/Week3/index.html @@ -0,0 +1,40 @@ + + + + + + + Document + + + +

my app

+ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Week3/moreJs-1.js b/Week3/moreJs-1.js new file mode 100644 index 000000000..cf0356919 --- /dev/null +++ b/Week3/moreJs-1.js @@ -0,0 +1,4 @@ +function sum (a,b,c){ + return a+b+c ; +} +console.log(sum(5,6,7)); \ No newline at end of file diff --git a/Week3/moreJs-10.js b/Week3/moreJs-10.js new file mode 100644 index 000000000..3d201c7d7 --- /dev/null +++ b/Week3/moreJs-10.js @@ -0,0 +1,26 @@ +/* +Use the list of vehicles to write an advertisement. + So that it prints something like: +"Amazing Joe's Garage, we service cars, +motorbikes, caravans and bikes.". +(Hint: use a for loop.) +*/ +function advertisement(){ + // let vehicles = [' motorbike' , ' caravan', ' bike', ' car']; + // variable 'vehicles' is can be read from moreJs-7and8.js + // but i used it again inside of function to show you, + // and in case you can run in a html seperately. + let products = []; + for(i=0; i Date: Thu, 16 May 2019 14:17:00 +0200 Subject: [PATCH 16/19] second console log added i just now understand challenge. I added a second console log using '?' --- Week3/moreJs-5.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Week3/moreJs-5.js b/Week3/moreJs-5.js index 95e3b9066..adafe32cd 100644 --- a/Week3/moreJs-5.js +++ b/Week3/moreJs-5.js @@ -7,8 +7,14 @@ if (3 === 3) { in the example above, (3 === 3) is always true thats why console logs "yes" surely. -if there is sth that i need to see or understand, unfortunately i did not. +if there is sth that i need to see or understand, unfortunately i did not. >> **last rows added** i am looking for feedback... */ -console.log("yes"); \ No newline at end of file +console.log("yes"); + +// ** last rows + +console.log ( (3 == 3) ? 'yes' : 'no'); + +// :))) i just now understand challange. is ti true? From 9e93e786b91afb6b54c28fd4f3c1473d96f59fce Mon Sep 17 00:00:00 2001 From: abdullah <45887687+heartwhite@users.noreply.github.com> Date: Fri, 24 May 2019 13:26:37 +0200 Subject: [PATCH 17/19] Update moreJs-6.js 1 - condition's (function) parameter changed as 'age' from 'years'. this way more consistent with lines above. 2- if statement added for the value of 'type' parameter. console logs the vehicle only if it has vehicle type. otherwise logs an warning --- Week3/moreJs-6.js | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/Week3/moreJs-6.js b/Week3/moreJs-6.js index a52fdc79f..c0589b9ff 100644 --- a/Week3/moreJs-6.js +++ b/Week3/moreJs-6.js @@ -5,15 +5,19 @@ Create a function called vehicle, like before, prints 'a blue used car' */ -function vehicle (color, type, age){ - let types = [' car' , ' motorbike']; - console.log('a ' + color +' ' + condition(age) + types[(type-1)]); +function vehicle(color, type, age) { + let types = [' car', ' motorbike', 'truck', 'bus']; + if (type > 0 && type <= types.length) { + console.log('a ' + color + ' ' + condition(age) + types[type - 1]); + } else { + console.log('!NO SUCH VEHICLE HERE'); + } } -function condition(years){ - if (years<2){ - return 'new'; - } else { - return 'used'; - } +function condition(age) { + if (age < 2) { + return 'new '; + } else { + return 'used '; + } } -vehicle('red' , 1, 3); \ No newline at end of file +vehicle('red', 3, 3); From 1654040591487b59e3ae1afe0ef82638bf900af6 Mon Sep 17 00:00:00 2001 From: abdullah <45887687+heartwhite@users.noreply.github.com> Date: Fri, 24 May 2019 13:27:11 +0200 Subject: [PATCH 18/19] Update moreJs-9.js 1 - condition's (function) parameter changed as 'age' from 'years'. this way more consistent with lines above. 2- if statement added for the value of 'type' parameter. console logs the vehicle only if it has vehicle type. otherwise logs an warning --- Week3/moreJs-9.js | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/Week3/moreJs-9.js b/Week3/moreJs-9.js index deae233e3..241594e70 100644 --- a/Week3/moreJs-9.js +++ b/Week3/moreJs-9.js @@ -3,18 +3,22 @@ Change the function vehicle to use the list of question 7. So that vehicle("green", 3, 1) prints "a green new bike". */ -function vehicle (color, type, age){ - let vehicles = ['motorbike' , 'caravan', 'bike', 'car']; - // variable 'vehicles' is can be read from moreJs-7and8.js - // but i used it again inside of function to show you, - // and in case you can run in a html seperately. - console.log('a ' + color +' ' + condition(age) + vehicles[(type-1)]); +function vehicle(color, type, age) { + let vehicles = ['motorbike', 'caravan', 'bike', 'car']; + // variable 'vehicles' is can be read from moreJs-7and8.js + // but i used it again inside of function to show you, + // and in case you can run in a html seperately. + if (type > 0 && type <= vehicles.length) { + console.log('a ' + color + ' ' + condition(age) + vehicles[type - 1]); + } else { + console.log('!NO SUCH VEHICLE HERE'); + } } -function condition(years){ - if (years<2){ - return 'new '; - } else { - return 'used '; - } +function condition(age) { + if (age < 2) { + return 'new '; + } else { + return 'used '; + } } -vehicle('green' , 3, 1); \ No newline at end of file +vehicle('green', 5, 1); From 438191754dd756f15623cb927cf4028568f4d9f4 Mon Sep 17 00:00:00 2001 From: abdullah <45887687+heartwhite@users.noreply.github.com> Date: Fri, 24 May 2019 13:29:47 +0200 Subject: [PATCH 19/19] Update moreJs-10.js removed unnecessary ',' from end of line 19. --- Week3/moreJs-10.js | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/Week3/moreJs-10.js b/Week3/moreJs-10.js index 3d201c7d7..d0d01eac6 100644 --- a/Week3/moreJs-10.js +++ b/Week3/moreJs-10.js @@ -5,22 +5,19 @@ Use the list of vehicles to write an advertisement. motorbikes, caravans and bikes.". (Hint: use a for loop.) */ -function advertisement(){ - // let vehicles = [' motorbike' , ' caravan', ' bike', ' car']; - // variable 'vehicles' is can be read from moreJs-7and8.js - // but i used it again inside of function to show you, - // and in case you can run in a html seperately. - let products = []; - for(i=0; i