-
Notifications
You must be signed in to change notification settings - Fork 255
homework week1 Muhammad Hussein #176
Changes from all commits
394edde
e28cf8c
721537e
2f71e9d
79faab4
40d0bfe
ba62245
e26255d
4176904
e5eeba5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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"); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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"); | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👏 |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 84"); | ||
| console.log(x); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 but you could also explore using conditional operators for assigning value to |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| "use strict"; | ||
| const animalsArr; | ||
| console.log("I think the value will be undefined"); | ||
| console.log(animalsArr); | ||
| const favoriteAnimals = ["Hamsters", "Cats", "Dogs",]; | ||
| console.log(favoriteAnimals); | ||
| favoriteAnimals.push("Horses"); | ||
| console.log(favoriteAnimals); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
|
|
||
| "use strict"; | ||
| const mySentence = "Programming is so interesting!"; | ||
| console.log(mySentence.length); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
|
|
||
| "use strict"; | ||
| const var1 = "customers"; | ||
| const var2 = "suppliers"; | ||
| const var3 = {storeName:"mainStore",storeId:001}; | ||
| const var4 = {itemName:"laptop",itemId:0200}; | ||
|
|
||
|
|
||
| console.log(typeof var1); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 for implementation but you could use
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed |
||
| 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") | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
|
|
||
| let x = 7; | ||
| 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; // the new value of y will be 1 . | ||
| let z = 13; // the new value of z will be 1 . | ||
|
|
||
| console.log(y); | ||
|
|
||
| console.log(z); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍