From 394eddefb12ef7353bd1b6860a230b33af2938fe Mon Sep 17 00:00:00 2001 From: MA-Hussein <54192398+MA-Hussein@users.noreply.github.com> Date: Sat, 21 Sep 2019 21:17:42 +0200 Subject: [PATCH 01/10] Create Js-exercises --- Week1/Js-exercises | 1 + 1 file changed, 1 insertion(+) create mode 100644 Week1/Js-exercises diff --git a/Week1/Js-exercises b/Week1/Js-exercises new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/Week1/Js-exercises @@ -0,0 +1 @@ + From e28cf8c2692e1594a263f717aa865e91b8c35b9b Mon Sep 17 00:00:00 2001 From: MA-Hussein <54192398+MA-Hussein@users.noreply.github.com> Date: Sat, 21 Sep 2019 21:18:27 +0200 Subject: [PATCH 02/10] Delete Js-exercises --- Week1/Js-exercises | 1 - 1 file changed, 1 deletion(-) delete mode 100644 Week1/Js-exercises diff --git a/Week1/Js-exercises b/Week1/Js-exercises deleted file mode 100644 index 8b1378917..000000000 --- a/Week1/Js-exercises +++ /dev/null @@ -1 +0,0 @@ - From 721537e02b5c5496a75bb98329e463f4031f1d12 Mon Sep 17 00:00:00 2001 From: MA-Hussein <54192398+MA-Hussein@users.noreply.github.com> Date: Sat, 21 Sep 2019 21:26:08 +0200 Subject: [PATCH 03/10] Add files via upload --- Week1/Js-exercises/read.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 Week1/Js-exercises/read.txt diff --git a/Week1/Js-exercises/read.txt b/Week1/Js-exercises/read.txt new file mode 100644 index 000000000..70705e791 --- /dev/null +++ b/Week1/Js-exercises/read.txt @@ -0,0 +1 @@ +read \ No newline at end of file From 2f71e9daf3cbf486164c23931dd7f4ec61b9ab21 Mon Sep 17 00:00:00 2001 From: muhammad Date: Sat, 21 Sep 2019 21:51:57 +0200 Subject: [PATCH 04/10] finished project for homework week1 --- Week1/Js-exercises/1-hello-world.js | 14 +++++ Week1/Js-exercises/10-compare-arrays.js | 13 +++++ Week1/Js-exercises/2-error-debugging.js | 4 ++ Week1/Js-exercises/3-log-the-number.js | 7 +++ Week1/Js-exercises/4-log-the-string.js | 8 +++ Week1/Js-exercises/5-round-a-number.js | 19 +++++++ Week1/Js-exercises/6-array-of-animals.js | 8 +++ Week1/Js-exercises/7-length-of-a-string.js | 4 ++ Week1/Js-exercises/8-type-checker.js | 62 ++++++++++++++++++++++ Week1/Js-exercises/9-log-the-remainder.js | 11 ++++ 10 files changed, 150 insertions(+) create mode 100644 Week1/Js-exercises/1-hello-world.js create mode 100644 Week1/Js-exercises/10-compare-arrays.js create mode 100644 Week1/Js-exercises/2-error-debugging.js create mode 100644 Week1/Js-exercises/3-log-the-number.js create mode 100644 Week1/Js-exercises/4-log-the-string.js create mode 100644 Week1/Js-exercises/5-round-a-number.js create mode 100644 Week1/Js-exercises/6-array-of-animals.js create mode 100644 Week1/Js-exercises/7-length-of-a-string.js create mode 100644 Week1/Js-exercises/8-type-checker.js create mode 100644 Week1/Js-exercises/9-log-the-remainder.js diff --git a/Week1/Js-exercises/1-hello-world.js b/Week1/Js-exercises/1-hello-world.js new file mode 100644 index 000000000..fb44b13fc --- /dev/null +++ b/Week1/Js-exercises/1-hello-world.js @@ -0,0 +1,14 @@ + +"use strict"; +console.log("Hello World"); +console.log("ãÑÍÈÇ ÈÇáÚÇáã"); +console.log("Hallo Wereld"); +console.log("Merhaba Dünya"); +console.log("Silav Dunya") +console.log("Halo Dunia"); +console.log("Hola Mundo"); +console.log("Ciao Mundo"); +console.log("Hei Verden"); +console.log("Dia duit ar domhan"); +console.log("Hallo wrâld"); +console.log("Bonjou mond lan"); \ No newline at end of file diff --git a/Week1/Js-exercises/10-compare-arrays.js b/Week1/Js-exercises/10-compare-arrays.js new file mode 100644 index 000000000..0adfe88e2 --- /dev/null +++ b/Week1/Js-exercises/10-compare-arrays.js @@ -0,0 +1,13 @@ + +"use strict"; +const arr1 = ["Spring" , "Summer" , "Autumn" , "Winter"]; +const arr2 = ["Saturday","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday"]; + +console.log("The first array's length is " + arr1.length); +console.log("The second array's length is " + arr2.length); + +if(arr1.length === arr2.length){ + console.log("They are the same!"); +}else { + console.log("Two different sizes"); +} \ No newline at end of file diff --git a/Week1/Js-exercises/2-error-debugging.js b/Week1/Js-exercises/2-error-debugging.js new file mode 100644 index 000000000..29cecbbd3 --- /dev/null +++ b/Week1/Js-exercises/2-error-debugging.js @@ -0,0 +1,4 @@ +"use strict"; +/* console.log('I'm awesome'); will not work because we need to escape the single quotation +mark we need to use \ character. */ +console.log('I\'m awesome'); //will work fine. \ No newline at end of file diff --git a/Week1/Js-exercises/3-log-the-number.js b/Week1/Js-exercises/3-log-the-number.js new file mode 100644 index 000000000..dcadf6aec --- /dev/null +++ b/Week1/Js-exercises/3-log-the-number.js @@ -0,0 +1,7 @@ +"use strict"; +let numberX; +console.log("I think x is undefined"); +console.log(x); +x = 84; +console.log("now x should be 26"); +console.log(x); \ No newline at end of file diff --git a/Week1/Js-exercises/4-log-the-string.js b/Week1/Js-exercises/4-log-the-string.js new file mode 100644 index 000000000..b3d2f9ebc --- /dev/null +++ b/Week1/Js-exercises/4-log-the-string.js @@ -0,0 +1,8 @@ +"use strict"; +let myString; +myString = "Muhammad Hussein"; +console.log("The value of the string will be my name as I wrote it."); +console.log(myString); +myString = "Muhammad" +console.log("my first name will be the result."); +console.log(myString); diff --git a/Week1/Js-exercises/5-round-a-number.js b/Week1/Js-exercises/5-round-a-number.js new file mode 100644 index 000000000..86f4d0ea1 --- /dev/null +++ b/Week1/Js-exercises/5-round-a-number.js @@ -0,0 +1,19 @@ +"use strict"; +let z; +z = 7.25; +console.log(z); + +let a; +a = Math.round(z); +console.log(a); + + +let newVariable; + +if(z > a){ + newVariable = z; +}else { + newVariable = a; +}; + +console.log(newVariable); \ No newline at end of file diff --git a/Week1/Js-exercises/6-array-of-animals.js b/Week1/Js-exercises/6-array-of-animals.js new file mode 100644 index 000000000..1f1b38657 --- /dev/null +++ b/Week1/Js-exercises/6-array-of-animals.js @@ -0,0 +1,8 @@ +"use strict"; +let animalsArr; +console.log("I think the value will be undefined"); +console.log(animalsArr); +let favoriteAnimals = ["Hamsters", "Cats", "Dogs",]; +console.log(favoriteAnimals); +favoriteAnimals.push("Horses"); +console.log(favoriteAnimals); \ No newline at end of file diff --git a/Week1/Js-exercises/7-length-of-a-string.js b/Week1/Js-exercises/7-length-of-a-string.js new file mode 100644 index 000000000..3f9b10c65 --- /dev/null +++ b/Week1/Js-exercises/7-length-of-a-string.js @@ -0,0 +1,4 @@ + +"use strict"; +let mySentence = "Programming is so interesting!"; +console.log(mySentence.length); \ No newline at end of file diff --git a/Week1/Js-exercises/8-type-checker.js b/Week1/Js-exercises/8-type-checker.js new file mode 100644 index 000000000..c9488e008 --- /dev/null +++ b/Week1/Js-exercises/8-type-checker.js @@ -0,0 +1,62 @@ + +"use strict"; +let var1 = "customers"; +let var2 = "suppliers"; +let var3 = {storeName:"mainStore",storeId:001}; +let var4 = {itemName:"laptop",itemId:0200}; + + +console.log(typeof var1); +console.log(typeof var3); + +if (typeof var1 === typeof var2){ + console.log("These two variables have the same type"); + +}else { + console.log("They are not the same type"); +}; + +if (typeof var1 === typeof var3){ + console.log("These two variables have the same type"); + +}else { + console.log("They are not the same type"); +}; + +if (typeof var1 === typeof var4){ + console.log("These two variables have the same type"); + +}else { + console.log("They are not the same type"); +}; + +if (typeof var2 === typeof var3){ + console.log("These two variables have the same type"); + +}else { + console.log("They are not the same type"); +}; + +if (typeof var2 === typeof var4){ + console.log("These two variables have the same type"); + +}else { + console.log("They are not the same type"); +}; + +if (typeof var3 === typeof var4){ + console.log("These two variables have the same type"); + +}else { + console.log("They are not the same type"); +}; + +if (typeof var1 !== typeof var3){ + console.log("They are not the same type"); +}; + +if (typeof var1 !== typeof var2){ + console.log("They are not the same type"); +}else { + console.log("These two variables have the same type") +}; \ No newline at end of file diff --git a/Week1/Js-exercises/9-log-the-remainder.js b/Week1/Js-exercises/9-log-the-remainder.js new file mode 100644 index 000000000..0c0eeb706 --- /dev/null +++ b/Week1/Js-exercises/9-log-the-remainder.js @@ -0,0 +1,11 @@ + +let x = 7; +x = x % 3 ; // new value of x will be 1 as it's remainder when it's divided by three is 1. +console.log(x); // we will see it is 1. + +let y = 21; // Their value would be the same.Because we didn't assign a new value to them. +let z = 13; + +console.log(y); /* We can see they still have their initial values. + Because the remainder includes x but not y and z.*/ +console.log(z); \ No newline at end of file From 79faab486fec16b92073d6391cf3857c1de9ca64 Mon Sep 17 00:00:00 2001 From: MA-Hussein <54192398+MA-Hussein@users.noreply.github.com> Date: Sat, 21 Sep 2019 22:29:41 +0200 Subject: [PATCH 05/10] Delete read.txt --- Week1/Js-exercises/read.txt | 1 - 1 file changed, 1 deletion(-) delete mode 100644 Week1/Js-exercises/read.txt diff --git a/Week1/Js-exercises/read.txt b/Week1/Js-exercises/read.txt deleted file mode 100644 index 70705e791..000000000 --- a/Week1/Js-exercises/read.txt +++ /dev/null @@ -1 +0,0 @@ -read \ No newline at end of file From 40d0bfeb650e99a3947c9ce7c1c0a4cc865d3659 Mon Sep 17 00:00:00 2001 From: MA-Hussein <54192398+MA-Hussein@users.noreply.github.com> Date: Tue, 24 Sep 2019 20:18:49 +0200 Subject: [PATCH 06/10] Update 3-log-the-number.js --- Week1/Js-exercises/3-log-the-number.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Week1/Js-exercises/3-log-the-number.js b/Week1/Js-exercises/3-log-the-number.js index dcadf6aec..642dde0a6 100644 --- a/Week1/Js-exercises/3-log-the-number.js +++ b/Week1/Js-exercises/3-log-the-number.js @@ -3,5 +3,5 @@ let numberX; console.log("I think x is undefined"); console.log(x); x = 84; -console.log("now x should be 26"); -console.log(x); \ No newline at end of file +console.log("now x should be 84"); +console.log(x); From ba62245222c4527d607f41947a1952d7dd125575 Mon Sep 17 00:00:00 2001 From: MA-Hussein <54192398+MA-Hussein@users.noreply.github.com> Date: Tue, 24 Sep 2019 20:24:59 +0200 Subject: [PATCH 07/10] Update 7-length-of-a-string.js --- Week1/Js-exercises/7-length-of-a-string.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Week1/Js-exercises/7-length-of-a-string.js b/Week1/Js-exercises/7-length-of-a-string.js index 3f9b10c65..8b06011e9 100644 --- a/Week1/Js-exercises/7-length-of-a-string.js +++ b/Week1/Js-exercises/7-length-of-a-string.js @@ -1,4 +1,4 @@ "use strict"; -let mySentence = "Programming is so interesting!"; -console.log(mySentence.length); \ No newline at end of file +const mySentence = "Programming is so interesting!"; +console.log(mySentence.length); From e26255d64a4b57dad854c177721cc2de2604fa58 Mon Sep 17 00:00:00 2001 From: MA-Hussein <54192398+MA-Hussein@users.noreply.github.com> Date: Tue, 24 Sep 2019 20:26:50 +0200 Subject: [PATCH 08/10] Update 8-type-checker.js --- Week1/Js-exercises/8-type-checker.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Week1/Js-exercises/8-type-checker.js b/Week1/Js-exercises/8-type-checker.js index c9488e008..54bad6823 100644 --- a/Week1/Js-exercises/8-type-checker.js +++ b/Week1/Js-exercises/8-type-checker.js @@ -1,9 +1,9 @@ "use strict"; -let var1 = "customers"; -let var2 = "suppliers"; -let var3 = {storeName:"mainStore",storeId:001}; -let var4 = {itemName:"laptop",itemId:0200}; +const var1 = "customers"; +const var2 = "suppliers"; +const var3 = {storeName:"mainStore",storeId:001}; +const var4 = {itemName:"laptop",itemId:0200}; console.log(typeof var1); @@ -59,4 +59,4 @@ if (typeof var1 !== typeof var2){ console.log("They are not the same type"); }else { console.log("These two variables have the same type") -}; \ No newline at end of file +}; From 417690489975d44e5c6490471f442e27cfe0ad7b Mon Sep 17 00:00:00 2001 From: MA-Hussein <54192398+MA-Hussein@users.noreply.github.com> Date: Tue, 24 Sep 2019 20:28:41 +0200 Subject: [PATCH 09/10] Update 6-array-of-animals.js --- Week1/Js-exercises/6-array-of-animals.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Week1/Js-exercises/6-array-of-animals.js b/Week1/Js-exercises/6-array-of-animals.js index 1f1b38657..ff8413b5d 100644 --- a/Week1/Js-exercises/6-array-of-animals.js +++ b/Week1/Js-exercises/6-array-of-animals.js @@ -1,8 +1,8 @@ "use strict"; -let animalsArr; +const animalsArr; console.log("I think the value will be undefined"); console.log(animalsArr); -let favoriteAnimals = ["Hamsters", "Cats", "Dogs",]; +const favoriteAnimals = ["Hamsters", "Cats", "Dogs",]; console.log(favoriteAnimals); favoriteAnimals.push("Horses"); -console.log(favoriteAnimals); \ No newline at end of file +console.log(favoriteAnimals); From e5eeba5db262e67df04edd63ab058abd5e931f30 Mon Sep 17 00:00:00 2001 From: MA-Hussein <54192398+MA-Hussein@users.noreply.github.com> Date: Tue, 24 Sep 2019 20:42:22 +0200 Subject: [PATCH 10/10] Update 9-log-the-remainder.js --- Week1/Js-exercises/9-log-the-remainder.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Week1/Js-exercises/9-log-the-remainder.js b/Week1/Js-exercises/9-log-the-remainder.js index 0c0eeb706..0a1731173 100644 --- a/Week1/Js-exercises/9-log-the-remainder.js +++ b/Week1/Js-exercises/9-log-the-remainder.js @@ -1,11 +1,11 @@ let x = 7; -x = x % 3 ; // new value of x will be 1 as it's remainder when it's divided by three is 1. +x = x % 3 ; // the new value of x will be 1 as it's remainder when it's divided by three is 1. console.log(x); // we will see it is 1. -let y = 21; // Their value would be the same.Because we didn't assign a new value to them. -let z = 13; +let y = 21; // the new value of y will be 1 . +let z = 13; // the new value of z will be 1 . -console.log(y); /* We can see they still have their initial values. - Because the remainder includes x but not y and z.*/ -console.log(z); \ No newline at end of file +console.log(y); + +console.log(z);