This repository was archived by the owner on May 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 255
JS1 Homework/Week2 #111
Closed
Closed
JS1 Homework/Week2 #111
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
3ffedb9
Add files via upload
Shvan1 208927e
Update app.js
Shvan1 4895621
Add files via upload
Shvan1 f18f53b
Add files via upload
Shvan1 ea60574
Merge pull request #1 from Shvan1/JSweek3
Shvan1 cc297b4
Update app.js
Shvan1 75c92a3
Update app.js
Shvan1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,141 @@ | ||
| //1. | ||
| let englishGreeting = "Hello, World!" | ||
| console.log(englishGreeting); | ||
| let kurdishGreeting = "Silav, Cihan!" | ||
| console.log(kurdishGreeting); | ||
| let dutchGreeting = "Hoi, Wereld!" | ||
| console.log(dutchGreeting); | ||
|
|
||
| //2. | ||
| let me = "I'm awesome!" | ||
| console.log(me); | ||
|
|
||
| //3.1 | ||
| let x; | ||
|
|
||
| //3.2 | ||
| console.log("I think the value of x will be: undefined"); | ||
|
|
||
| //3.3 | ||
| console.log(x); | ||
|
|
||
| //3.4 | ||
| let x = 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"; | ||
|
|
||
| //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) | ||
|
|
||
| //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 | ||
| const animals = myFavoriteAnimals.push('baby pig'); | ||
|
|
||
| //6.7 | ||
| console.log(animals); | ||
|
|
||
| //7.1 | ||
| let myString = "this is a test"; | ||
|
|
||
| //7.2 | ||
| console.log(myString); | ||
|
|
||
| //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); | ||
|
|
||
| //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; | ||
| 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); | ||
|
|
||
| //10.2 | ||
| if (maxNumber === Infinity){ | ||
| console.log(0 / maxNumber); | ||
Shvan1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,131 @@ | ||
| //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. | ||
|
|
||
| //the end. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.