From e6259e5ba1da43aa860474d6bb9691f008a37e1c Mon Sep 17 00:00:00 2001 From: AmnaAhmad Date: Fri, 29 Nov 2019 07:17:16 +0100 Subject: [PATCH 1/5] my home work --- Week1/homework/js-exercises/exercise2.js | 2 ++ Week1/homework/js-exercises/exercises3.js | 8 ++++++++ Week1/homework/js-exercises/logHallo.js | 11 +++++++++++ 3 files changed, 21 insertions(+) create mode 100644 Week1/homework/js-exercises/exercise2.js create mode 100644 Week1/homework/js-exercises/exercises3.js create mode 100644 Week1/homework/js-exercises/logHallo.js diff --git a/Week1/homework/js-exercises/exercise2.js b/Week1/homework/js-exercises/exercise2.js new file mode 100644 index 000000000..665364a3f --- /dev/null +++ b/Week1/homework/js-exercises/exercise2.js @@ -0,0 +1,2 @@ +'use strict'; +console.log("I'm awesome"); \ No newline at end of file diff --git a/Week1/homework/js-exercises/exercises3.js b/Week1/homework/js-exercises/exercises3.js new file mode 100644 index 000000000..f14c5dd08 --- /dev/null +++ b/Week1/homework/js-exercises/exercises3.js @@ -0,0 +1,8 @@ +'use strict'; + +let numberX; +console.log('undefined, because the variable is not assigned a value'); +console.log(numberX); +numberX = 10; +console.log('10, because now it has been assigned a value 10'); +console.log(numberX); \ No newline at end of file diff --git a/Week1/homework/js-exercises/logHallo.js b/Week1/homework/js-exercises/logHallo.js new file mode 100644 index 000000000..afd3d5077 --- /dev/null +++ b/Week1/homework/js-exercises/logHallo.js @@ -0,0 +1,11 @@ +'use strict'; +console.log('Hello ' + 'World'); // English +console.log('Halo ' + 'Mundo'); //Spanish +console.log('こんにちは ' + '世界'); //日本人 +console.log('Bongu ' + 'Tad-dinja'); // Maltese +console.log('שלום ' + 'עולם'); // Hebrew +console.log('مرحبا ' + 'العالمية'); // Arabic +console.log('Hej ' + 'Verden'); // Danish +console.log('алло ' + 'Мир'); // Russian +console.log('هالو ' + 'ودرلد'); // Persian +console.log('slav ' + 'Dinya'); // Kurdish \ No newline at end of file From 87b60b5a84e7ef863cf17b4681198210a4fbac0b Mon Sep 17 00:00:00 2001 From: AmnaAhmad Date: Fri, 29 Nov 2019 13:56:22 +0100 Subject: [PATCH 2/5] my homework for javascript week1 --- Week1/homework/js-exercises/exercise4.js | 9 +++ Week1/homework/js-exercises/exercise5.js | 7 +++ Week1/homework/js-exercises/exercises10.js | 12 ++++ Week1/homework/js-exercises/exercises3.js | 12 ++-- Week1/homework/js-exercises/exercises6.js | 9 +++ Week1/homework/js-exercises/exercises7.js | 3 + Week1/homework/js-exercises/exercises8.js | 69 ++++++++++++++++++++++ Week1/homework/js-exercises/exercises9.js | 29 +++++++++ 8 files changed, 144 insertions(+), 6 deletions(-) create mode 100644 Week1/homework/js-exercises/exercise4.js create mode 100644 Week1/homework/js-exercises/exercise5.js create mode 100644 Week1/homework/js-exercises/exercises10.js create mode 100644 Week1/homework/js-exercises/exercises6.js create mode 100644 Week1/homework/js-exercises/exercises7.js create mode 100644 Week1/homework/js-exercises/exercises8.js create mode 100644 Week1/homework/js-exercises/exercises9.js diff --git a/Week1/homework/js-exercises/exercise4.js b/Week1/homework/js-exercises/exercise4.js new file mode 100644 index 000000000..2973ece1d --- /dev/null +++ b/Week1/homework/js-exercises/exercise4.js @@ -0,0 +1,9 @@ +'use strict'; +let myString = 'Amna Ahmad'; //1 +console.log('the value is the string above'); //2 +console.log(myString); //3 + myString = 'a new string'; //4 +console.log('the new string'); //5 +console.log(myString); + + diff --git a/Week1/homework/js-exercises/exercise5.js b/Week1/homework/js-exercises/exercise5.js new file mode 100644 index 000000000..e1eb21c4f --- /dev/null +++ b/Week1/homework/js-exercises/exercise5.js @@ -0,0 +1,7 @@ +'use strict'; +const z = 7.25; +console.log(z); +const a = 7; +console.log(a); +const biggistNumber = a > z ? a : z; +console.log(biggistNumber); diff --git a/Week1/homework/js-exercises/exercises10.js b/Week1/homework/js-exercises/exercises10.js new file mode 100644 index 000000000..dce204768 --- /dev/null +++ b/Week1/homework/js-exercises/exercises10.js @@ -0,0 +1,12 @@ +'use strict'; +const firstArray = ["good", 26, true, {name: "Amna"}]; +const secondArray = ["beter", 38, false, "why?", "Who", "what", {frinds: "Hala"}]; + +console.log('The length of the first array is ...' + firstArray.length); +console.log('The length of the second array is ...' + secondArray.length); + +if(firstArray.length == secondArray.length){ + console.log("They are the same!") +}else{ + console.log("Two different sizes") +} \ No newline at end of file diff --git a/Week1/homework/js-exercises/exercises3.js b/Week1/homework/js-exercises/exercises3.js index f14c5dd08..aa0c3f80d 100644 --- a/Week1/homework/js-exercises/exercises3.js +++ b/Week1/homework/js-exercises/exercises3.js @@ -1,8 +1,8 @@ 'use strict'; -let numberX; -console.log('undefined, because the variable is not assigned a value'); -console.log(numberX); -numberX = 10; -console.log('10, because now it has been assigned a value 10'); -console.log(numberX); \ No newline at end of file +let numberX; // 1 +console.log('undefined, because the variable is not assigned a value'); //2 +console.log(numberX); //3 +numberX = 10; //4 +console.log('10, because now it has been assigned a value 10'); //5 +console.log(numberX); //6 diff --git a/Week1/homework/js-exercises/exercises6.js b/Week1/homework/js-exercises/exercises6.js new file mode 100644 index 000000000..f2bbb8ebc --- /dev/null +++ b/Week1/homework/js-exercises/exercises6.js @@ -0,0 +1,9 @@ +'use strict'; +const paragraphs = []; //1 +console.log('I have to show an empty arrey'); //2 +console.log(paragraphs); //3 + +const favoriteAnimals = ['fish ', 'butterfly ', ' rabbit ' ]; //4 +console.log(favoriteAnimals); //5 +favoriteAnimals.push('Piglet'); +console.log(favoriteAnimals); \ No newline at end of file diff --git a/Week1/homework/js-exercises/exercises7.js b/Week1/homework/js-exercises/exercises7.js new file mode 100644 index 000000000..8f920a5d5 --- /dev/null +++ b/Week1/homework/js-exercises/exercises7.js @@ -0,0 +1,3 @@ +'use strict'; +const mySentence = "Programming is so interesting!"; +console.log(mySentence.length); \ No newline at end of file diff --git a/Week1/homework/js-exercises/exercises8.js b/Week1/homework/js-exercises/exercises8.js new file mode 100644 index 000000000..58e98526d --- /dev/null +++ b/Week1/homework/js-exercises/exercises8.js @@ -0,0 +1,69 @@ +'use strict'; + const name = 'Amna'; //string + const lastName = 'Ahmad';//string + + const firstObject = { + fatherName : 'Musleh', + motherName: 'Fatima', + brotherName:'Sagvan' + }//object + const secondObject = { + bigSister : 'Torfa', + secondSister: 'Nesrin', + therdSister:'Janda' + }//object + +console.log(name); +console.log(lastName); +console.log(firstObject); +console.log(secondObject); + + +//first conditional + +if(typeof name == typeof lastName) { + console.log('the both of name and lastName are string'); +} else{ + console.log('the both of name and lastName are not string'); +} +//socond conditional + +if(typeof firstObject == typeof secondObject) { + console.log('the both of firstObject and secondObject are string'); + } else{ + console.log('the both of firstObject and secondObject are object'); + } + //therd conditional +if(typeof name == typeof secondObject) { + console.log('the both of name and secondObject are string'); +} else{ + console.log('the name is string and secondObject is object'); +} + + + //fourth conditional + if(typeof lastName == typeof firstObject) { + console.log('all of this are not different'); + } else{ + console.log('lastName is string but first object is an object '); + } + + //fivth conditional + + if(typeof name == typeof firstObject) { + console.log('all of this are not different'); + } else{ + console.log('name is string but firstObject is an object'); + } + //sixth conditional + if(typeof lastName == typeof secondObject) { + console.log('all of this are not different'); + } else{ + console.log('lastName is string but secondObject is an object'); + } + + + console.log(typeof name); + console.log(typeof firstObject); + + console.log(typeof name, typeof firstObject); \ No newline at end of file diff --git a/Week1/homework/js-exercises/exercises9.js b/Week1/homework/js-exercises/exercises9.js new file mode 100644 index 000000000..310d6b51f --- /dev/null +++ b/Week1/homework/js-exercises/exercises9.js @@ -0,0 +1,29 @@ +'use strict'; +let x = 7; +x = x % 3; +console.log(x); +/*the answer is 1 . the solution is +7 / 3 = 2 ; +2 * 3 = 6 ; +7 - 6 = 1; + */ + +let y =21; + y = y %4; +console.log(y); +/*the answer is 1 . the solution is +21 / 4 = 5 ; +5 * 4 = 20 ; +21 - 20 = 1; + */ + + let z = 13; + z = z % 2 ; +console.log(y); +/*the answer is 1 . the solution is +13 / 2 = 6 ; +6 * 2 = 12 ; +13 - 12 = 1; + */ + + From 56306165e8ca80f33f9dd99761bf8803df36f0a5 Mon Sep 17 00:00:00 2001 From: AmnaAhmad <57315367+AmnaAhmad@users.noreply.github.com> Date: Sun, 1 Dec 2019 15:14:25 +0100 Subject: [PATCH 3/5] Update exercise2.js --- Week1/homework/js-exercises/exercise2.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Week1/homework/js-exercises/exercise2.js b/Week1/homework/js-exercises/exercise2.js index 665364a3f..50cc308f3 100644 --- a/Week1/homework/js-exercises/exercise2.js +++ b/Week1/homework/js-exercises/exercise2.js @@ -1,2 +1,2 @@ 'use strict'; -console.log("I'm awesome"); \ No newline at end of file +console.log("I'm awesome") From a83d8d1b727ea55e675e88fe7544baebde4ed0b6 Mon Sep 17 00:00:00 2001 From: AmnaAhmad <57315367+AmnaAhmad@users.noreply.github.com> Date: Sat, 7 Dec 2019 22:31:26 +0100 Subject: [PATCH 4/5] Update exercises10.js --- Week1/homework/js-exercises/exercises10.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Week1/homework/js-exercises/exercises10.js b/Week1/homework/js-exercises/exercises10.js index dce204768..61ff1b797 100644 --- a/Week1/homework/js-exercises/exercises10.js +++ b/Week1/homework/js-exercises/exercises10.js @@ -8,5 +8,5 @@ console.log('The length of the second array is ...' + secondArray.length); if(firstArray.length == secondArray.length){ console.log("They are the same!") }else{ - console.log("Two different sizes") -} \ No newline at end of file + console.log("Two different sizes"); +} From f4625201c10b6892b3bdcfcf18f72842754db10b Mon Sep 17 00:00:00 2001 From: AmnaAhmad <57315367+AmnaAhmad@users.noreply.github.com> Date: Sat, 7 Dec 2019 22:49:11 +0100 Subject: [PATCH 5/5] Update exercises10.js --- Week1/homework/js-exercises/exercises10.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Week1/homework/js-exercises/exercises10.js b/Week1/homework/js-exercises/exercises10.js index 61ff1b797..6b7db1bd3 100644 --- a/Week1/homework/js-exercises/exercises10.js +++ b/Week1/homework/js-exercises/exercises10.js @@ -9,4 +9,4 @@ if(firstArray.length == secondArray.length){ console.log("They are the same!") }else{ console.log("Two different sizes"); -} +};