From 3ffedb9c7a7686fe5fc64533c1e35fa26b783b94 Mon Sep 17 00:00:00 2001 From: Shvan <48798783+Shvan1@users.noreply.github.com> Date: Sun, 5 May 2019 19:38:47 +0200 Subject: [PATCH 1/6] Add files via upload --- app.js | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 app.js diff --git a/app.js b/app.js new file mode 100644 index 000000000..910486d56 --- /dev/null +++ b/app.js @@ -0,0 +1,77 @@ + +console.log("Hello, World!"); //->English +console.log("Silav, Cihan!");//->Kurdish +console.log("Hoi, Wereld!"); //->Dutch + +console.log("I'm awesome!"); + +let x = +console.log('I think the value of x is bigger than 5'); +console.log("The value of x is 6"); +let x = 6; +console.log(I think the value of x is 6); +console.log(x); + +let y ="Sivan"; +console.log("I think the value of y is a name"); +console.log(y); +const y = "Hassam"; +console.log("There will be an error because now I have + the same variable with different values."); +console.log(y); + +const z = 7.25; +console.log(z); +const a = z; +console.log(a); +var round =Math.round(7.25); +console.log(round) + +let arrays = +console.log("I think variable arrays is related to animals"); +console.log(arrays); +let myFavoriteAnimals = [cat, dog, sheep]; +console.log(myFavoriteAnimals); +let favoriteAnimalOfDaan = "baby pig"; +const animals = "myFavoriteAnimals" + "" + "favoriteAnimalOfDaan"; +console.log(animals); + +let myString = "this is a test"; +console.log(myString); +console.log(myString ["length"]); + +let num = 11; +let address = "Huygenhoekring"; +let supermarkets = ["Lidl", "Dekka", "Jumbo"]; +let booleans = true, false, true; +console.log(num); +console.log(address); +console.log(supermarkets); +console.log(booleans); +console.log(I think the type of num is number, + type of address is string, + type of supermarkets is array and + type of booleans is boolean.); +console.log(typeof num); +console.log(typeof supermarkets); +console.log(typeof booleans); +console.log(typeof address); + +if (num != address) { + console.log("num is a number and address is a string"); +} + +let s = 7; +let v = 3; +let h = s % 3; +console.log(s % h); +console.log(s % v); +console.log(v % h); + +const mix = [5, "Shvan"]; +console.log(mix); + +var maxNumber = Math.pow(6/0); + +if (maxNumber === Infinity) +console.log(0 / maxNumber); From 208927ec744c5d7268f27ea79e0e47d881564642 Mon Sep 17 00:00:00 2001 From: Shvan <48798783+Shvan1@users.noreply.github.com> Date: Sun, 12 May 2019 11:21:42 +0200 Subject: [PATCH 2/6] Update app.js --- app.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/app.js b/app.js index 910486d56..d79ec272e 100644 --- a/app.js +++ b/app.js @@ -1,15 +1,18 @@ +let englishGreeting = "Hello, World!" +console.log(englishGreeting); +let kurdishGreeting = "Silav, Cihan!" +console.log(kurdishGreeting); +let dutchGreeting = "Hoi, Wereld!" +console.log(dutchGreeting); -console.log("Hello, World!"); //->English -console.log("Silav, Cihan!");//->Kurdish -console.log("Hoi, Wereld!"); //->Dutch +let me = "I'm awesome!" +console.log(me); -console.log("I'm awesome!"); - -let x = -console.log('I think the value of x is bigger than 5'); +let x; +console.log("I think the value of x is a number"); console.log("The value of x is 6"); let x = 6; -console.log(I think the value of x is 6); +console.log("I think the value of x is 6"); console.log(x); let y ="Sivan"; From 48956216fd5da2bbb4e846645f45f97be339e6c9 Mon Sep 17 00:00:00 2001 From: Shvan <48798783+Shvan1@users.noreply.github.com> Date: Sat, 18 May 2019 03:26:22 +0200 Subject: [PATCH 3/6] Add files via upload Week3 Homeworkof JS --- week3.js | 129 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 week3.js diff --git a/week3.js b/week3.js new file mode 100644 index 000000000..905616ca7 --- /dev/null +++ b/week3.js @@ -0,0 +1,129 @@ +//String +let myString = "Hello,this,is,a,difficult-,to-,read,sentence"; +console.log(myString); +console.log(myString.length); +myString = myString.replace(/,/g, " "); +console.log(myString); + +//Arrays +let favoriteAnimals = ["blowfish", "capricorn", "giraffe"]; +console.log(favoriteAnimals); + +let favoriteAnimalsOfMauro = ["blowfish", "capricorn", "giraffe", "turtle"]; +console.log(favoriteAnimalsOfMauro); + +let favoriteAnimalsOfJim = ["blowfish", "meerkat", "capricorn", "giraffe", "turtle"]; +console.log("The favorite animal of Jim is added to the array."); +console.log(favoriteAnimalsOfJim); +console.log("The array has a length of:", favoriteAnimalsOfJim.length); + +let favoriteAnimalsOfJason = ["blowfish", "meerkat", "capricorn", "turtle"]; +console.log(favoriteAnimalsOfJason); +console.log(favoriteAnimalsOfJason.length); +console.log(favoriteAnimalsOfJason[1], "The item you are looking for is at index:2"); + +//JavaScript +function sum(a, b, c) { + return a + b + c; +} +console.log(sum(5, 3, 2)); +//2. +function colorCar(color){ + return "A" + color + "car"; + } + console.log(colorCar("red")); +//3. +let country = {Land: "The Netherlands", Population:"17 million", Capital:"Amsterdam"}; +console.log(country); +console.log(country.Land); +console.log(country.Population); +//4. +function vehicleType(color, code){ + if (code === 1){ + console.log("A" + color + "car"); +} else if (code === 2){ +console.log("A" + color + "motorbike");} +} +vehicleType("blue", 2); +//5. +3===3 ? console.log("Yes") : console.log("No"); +//6 +function vehicle(color, code, age){ + if (code === 1 || age > 5){ + console.log("A" + "" + color + "" + "used car"); +} else if (code === 2 || age < 5){ + console.log("A" + "" + color + "" + "new car"); +} + } +vehicle("blue", 1, 5); +//7. +const vehicleList = [ + "motorbike", + "caravan", + "bike", + "bicycle", + "car" +]; +console.log(vehicleList.length); +console.log(vehicleList[2]); + +//9 +function newVehicle(color){ + if (vehicleList[2] = 3){ + console.log("A" + "" + color + "" + "new" + "" + "bike"); + } else (vehicleList[2] > 3);{ + console.log("A" + "" + color + "" + "old" + "" + "bike") + } +} +newVehicle("green", 3, 1); + +//10 +const advertisement = vehicleList; +console.log(advertisement); +for (let index = 0; index < advertisement; index++) { + console.log(advertisement[index]); +} +if (advertisement.length = 5) { + console.log("Amazing Joe's Garage >>> Here we service cars, motorbikes, caravans and bikes."); +}else { + console.log("Amazing Joe's Garage >>> Here we service bulldozers, lorries and trucks."); +} +//11 +const newVehicleList = advertisement + "" + "scooter"; +console.log(newVehicleList); +//12. +let object; +//13+14 +let teachers = {Philip: "HTML/CSS", Rob: "HTML/CSS", Hardit: "CLI", Bonan: "CLI", Ogor: "CLI", Unmesh: "GIT", Marciano: "JS", Sander: "JS"}; + +//15 +let x = [1, 2, 3]; +let y = [1, 2, 3]; +let z = y; +console.log(x == y); +console.log(x === y); + +console.log(x == z); +console.log(x === z); + +console.log(y == z); +console.log(y === z); + +//16. +let o1 = { foo: "bar" }; +let o2 = { foo: "bar" }; +let o3 = o2; +console.log(o1); +console.log(o2); +console.log(o3); +//Do you mean to make new ones? +let o1New = {quur: "quuur"}; +let o2New = {quur: "quuur"}; +let o3New = o2New; +console.log(o1New); + +//17. +let bar = 42; +typeof typeof bar; +console.log(typeof bar); //->> number. +console.log(typeof typeof bar); //->> string. From f18f53bf162d7add228b691ea505aeda727bfa92 Mon Sep 17 00:00:00 2001 From: Shvan <48798783+Shvan1@users.noreply.github.com> Date: Sat, 18 May 2019 14:19:27 +0200 Subject: [PATCH 4/6] Add files via upload --- week3.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/week3.js b/week3.js index 905616ca7..c9ba185a6 100644 --- a/week3.js +++ b/week3.js @@ -127,3 +127,5 @@ let bar = 42; typeof typeof bar; console.log(typeof bar); //->> number. console.log(typeof typeof bar); //->> string. + +//the end. \ No newline at end of file From cc297b4fab6af6b473fa61b809c99f090bd6853d Mon Sep 17 00:00:00 2001 From: Shvan <48798783+Shvan1@users.noreply.github.com> Date: Sat, 25 May 2019 22:42:48 +0200 Subject: [PATCH 5/6] Update app.js I have split the questions and corrected some mistakes that figured out by Marciano. --- app.js | 90 +++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 76 insertions(+), 14 deletions(-) diff --git a/app.js b/app.js index d79ec272e..68d3aca07 100644 --- a/app.js +++ b/app.js @@ -1,3 +1,4 @@ +//1. let englishGreeting = "Hello, World!" console.log(englishGreeting); let kurdishGreeting = "Silav, Cihan!" @@ -5,65 +6,122 @@ console.log(kurdishGreeting); let dutchGreeting = "Hoi, Wereld!" console.log(dutchGreeting); +//2. let me = "I'm awesome!" console.log(me); +//3.1 let x; -console.log("I think the value of x is a number"); -console.log("The value of x is 6"); + +//3.2 +console.log("I think the value of x will be: undefined"); + +//3.3 +console.log(x); + +//3.4 let x = 6; -console.log("I think the value of x is 6"); + +//3.5 +console.log("the value of x is: 6"); + +//3.6 console.log(x); +//4.1 let y ="Sivan"; + +//4.2 console.log("I think the value of y is a name"); + +//4.3 console.log(y); + +//4.4 const y = "Hassam"; -console.log("There will be an error because now I have - the same variable with different values."); + +//4.5 +console.log("There will be an error because now I have the same variable with different values."); + +//4.6 console.log(y); +//5. const z = 7.25; + +//5.1 console.log(z); + +//5.2 const a = z; + +//5.3 console.log(a); + +//5.4 var round =Math.round(7.25); + +//5.6 console.log(round) -let arrays = -console.log("I think variable arrays is related to animals"); +//6.1 +let arrays; + +//6.2 +console.log("I think the value will be undefined"); + +//6.3 console.log(arrays); + +//6.4 let myFavoriteAnimals = [cat, dog, sheep]; + +//6.5 console.log(myFavoriteAnimals); + +//6.6 let favoriteAnimalOfDaan = "baby pig"; -const animals = "myFavoriteAnimals" + "" + "favoriteAnimalOfDaan"; +const animals = myFavoriteAnimals + "" + favoriteAnimalOfDaan; + +//6.7 console.log(animals); +//7.1 let myString = "this is a test"; + +//7.2 console.log(myString); -console.log(myString ["length"]); +//7.3 +console.log(myString.length); + +//8.1 let num = 11; let address = "Huygenhoekring"; let supermarkets = ["Lidl", "Dekka", "Jumbo"]; let booleans = true, false, true; + +//8.2 console.log(num); console.log(address); console.log(supermarkets); console.log(booleans); -console.log(I think the type of num is number, - type of address is string, - type of supermarkets is array and - type of booleans is boolean.); + +//8.3 +console.log("I think the type of num is number, type of address is string, type of supermarkets is array and type of booleans is boolean."); + +//8.4 console.log(typeof num); console.log(typeof supermarkets); console.log(typeof booleans); console.log(typeof address); +//8.5 if (num != address) { console.log("num is a number and address is a string"); } +//9.1 let s = 7; let v = 3; let h = s % 3; @@ -71,10 +129,14 @@ console.log(s % h); console.log(s % v); console.log(v % h); +//10.1 const mix = [5, "Shvan"]; console.log(mix); +//10.2 var maxNumber = Math.pow(6/0); -if (maxNumber === Infinity) +//10.2 +if (maxNumber === Infinity){ console.log(0 / maxNumber); +} From 75c92a3bc387765fbe5dc694f69019b05cf68538 Mon Sep 17 00:00:00 2001 From: Shvan <48798783+Shvan1@users.noreply.github.com> Date: Thu, 30 May 2019 01:43:22 +0200 Subject: [PATCH 6/6] Update app.js question 6.6 is edited. --- app.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app.js b/app.js index 68d3aca07..4f72bdb2f 100644 --- a/app.js +++ b/app.js @@ -74,14 +74,13 @@ console.log("I think the value will be undefined"); console.log(arrays); //6.4 -let myFavoriteAnimals = [cat, dog, sheep]; +let myFavoriteAnimals = ['cat', 'dog', 'sheep']; //6.5 console.log(myFavoriteAnimals); //6.6 -let favoriteAnimalOfDaan = "baby pig"; -const animals = myFavoriteAnimals + "" + favoriteAnimalOfDaan; +const animals = myFavoriteAnimals.push('baby pig'); //6.7 console.log(animals);