Repository navigation
homework week1 Muhammad Hussein #176
Changes from 5 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 26"); | ||
| console.log(x); | ||
|
MA-Hussein marked this conversation as resolved.
Resolved
|
||
| 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"; | ||
| 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); | ||
|
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. 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 |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
|
|
||
| "use strict"; | ||
| let mySentence = "Programming is so interesting!"; | ||
| console.log(mySentence.length); | ||
|
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.
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 |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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); | ||
|
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 ; // 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); | ||
|
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. 😄. There was an error in the homework which David corrected this morning. Would you like to revisit?
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. Updated according to the homework updates . Thanks a lot Ysah for your helpful comments . |
||
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.
👍