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
Abdullah week3 JS homework #120
Closed
Closed
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
e2d8f46
abdullah github-username:heartwhite
heartwhite aa3a591
Merge pull request #1 from heartwhite/heartwhite-patch-1
heartwhite e8c1499
Update arrays.js
heartwhite 7955dcf
Update checkType.js
heartwhite ef95710
Update compairingInfinities.js
heartwhite 374834a
Update helloInDifLang.js
heartwhite 5ee2deb
Update numberRounding.js
heartwhite 92112f6
Update varXInteger.js
heartwhite 2e3f3c1
Update arrays.js
heartwhite 8d56989
Update MAKEME.md
heartwhite da68d90
Update arrays.js
heartwhite ed54c37
Update checkType.js
heartwhite 915f56b
Update compairingInfinities.js
heartwhite 3479de7
Update helloInDifLang.js
heartwhite bf3fd09
Update numberRounding.js
heartwhite 49ed56e
Abdullah JS week 3
heartwhite 077d2c1
Merge pull request #2 from heartwhite/heartwhite-patch-1
heartwhite 0887518
second console log added
heartwhite 9e93e78
Update moreJs-6.js
heartwhite 1654040
Update moreJs-9.js
heartwhite 4381917
Update moreJs-10.js
heartwhite 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,8 @@ | ||
| //append arrays | ||
| let arraysInside = []; | ||
| console.log ('my array will contain some animals'); | ||
| console.log(arraysInside); | ||
| let myFavoriteAnimals = ['eagle ', 'dog ', 'horse ']; | ||
| console.log(myFavoriteAnimals); | ||
| myFavoriteAnimals.push('baby pig'); | ||
| console.log(myFavoriteAnimals); |
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,85 @@ | ||
| //using the 'typeof' and compairing types with if statement | ||
| const myName = 'abdullah'; | ||
| let myAge = 33; | ||
| let myHobbies = ['swimming', 'coding', 'taking photographs']; | ||
| let iAmFunny = true; | ||
| let amIFunny = 'yes'; | ||
| console.log(myName); | ||
| console.log(myAge); | ||
| console.log(myHobbies); | ||
| console.log(iAmFunny); | ||
| console.log(amIFunny); | ||
| console.log('types of my variables are: string, number, array, boolean, string \(again\)'); | ||
| console.log(typeof myName); | ||
| console.log(typeof myAge); | ||
| console.log(typeof myHobbies); | ||
| console.log(typeof iAmFunny); | ||
| console.log(typeof amIFunny); | ||
|
|
||
|
|
||
| if(typeof myName === typeof myAge){ | ||
| console.log('SAME TYPE') | ||
| } else{ | ||
| console.log('NOT SAME TYPE') | ||
| } | ||
|
|
||
| if(typeof myName === typeof myHobbies){ | ||
| console.log('SAME TYPE') | ||
| } else{ | ||
| console.log('NOT SAME TYPE') | ||
| } | ||
|
|
||
| if(typeof myName === typeof iAmFunny){ | ||
| console.log('SAME TYPE') | ||
| } else{ | ||
| console.log('NOT SAME TYPE') | ||
| } | ||
|
|
||
| if(typeof myName === typeof myAge){ | ||
| console.log('SAME TYPE') | ||
| } else{ | ||
| console.log('NOT SAME TYPE') | ||
| } | ||
|
|
||
| if(typeof myName === typeof amIFunny){ | ||
| console.log('SAME TYPE') | ||
| } else{ | ||
| console.log('NOT SAME TYPE') | ||
| } | ||
|
|
||
| if(typeof myAge === typeof myHobbies){ | ||
| console.log('SAME TYPE') | ||
| } else{ | ||
| console.log('NOT SAME TYPE') | ||
| } | ||
|
|
||
| if(typeof myAge === typeof iAmFunny){ | ||
| console.log('SAME TYPE') | ||
| } else{ | ||
| console.log('NOT SAME TYPE') | ||
| } | ||
|
|
||
| if(typeof myAge === typeof amIFunny){ | ||
| console.log('SAME TYPE') | ||
| } else{ | ||
| console.log('NOT SAME TYPE') | ||
| } | ||
|
|
||
| if(typeof myHobbies === typeof iAmFunny){ | ||
| console.log('SAME TYPE') | ||
| } else{ | ||
| console.log('NOT SAME TYPE') | ||
| } | ||
|
|
||
| if(typeof myHobbies === typeof amIFunny){ | ||
| console.log('SAME TYPE') | ||
| } else{ | ||
| console.log('NOT SAME TYPE') | ||
| } | ||
|
|
||
| if(typeof iAmFunny === typeof amIFunny){ | ||
| console.log('SAME TYPE') | ||
| } else{ | ||
| console.log('NOT SAME TYPE') | ||
| } | ||
|
|
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,19 @@ | ||
| // store diffrent types of data in one array, and compare the infinitives | ||
| let allTypesInsideArray = ['abdullah ', 33 , true]; | ||
| console.log(allTypesInsideArray); | ||
|
|
||
|
|
||
| console.log('2 examples for compairing infinities') | ||
| let infinitive1 = 6/0; | ||
| let infinitive2 = 10/0; | ||
| if(infinitive1 === infinitive2){ | ||
| console.log(true); | ||
| } else{ | ||
| console.log(false); | ||
| } | ||
|
|
||
| console.log(infinitive1 == infinitive2); | ||
|
|
||
| /*in exercise of infinitives i used == and === both | ||
| because in this case i wanted to see each option. | ||
| i guess types are same but i just anted to see */ |
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,3 @@ | ||
| console.log ('hello world'); //english | ||
| console.log ('здравствуйте мира'); //russian | ||
| console.log('merhaba dunya'); //turkish |
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,24 @@ | ||
|
|
||
| <html> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <meta name="viewport" | ||
| content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> | ||
| <meta http-equiv="X-UA-Compatible" content="ie=edge"> | ||
| <title>Hack Your Future</title> | ||
| </head> | ||
| <body> | ||
| <h1>Hello world!</h1> | ||
| <script src="app.js"></script> | ||
| <script src="helloInDifLang.js"></script> | ||
| <script src="inlineQuote.js"></script> | ||
| <script src="varXInteger.js"></script> | ||
| <script src="varYString.js"></script> | ||
| <script src="numberRounding.js"></script> | ||
| <script src="arrays.js"></script> | ||
| <script src="stringtLenght.js"></script> | ||
| <script src="checkType.js"></script> | ||
| <script src="percentageCharacter.js"></script> | ||
| <script src="compairingInfinities.js"></script> | ||
| </body> | ||
| </html> |
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 @@ | ||
| console.log('I\'m awesome'); |
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,15 @@ | ||
| //round and compair numbers | ||
| let z = 7.25; | ||
| console.log(z); | ||
| let a = Math.round(z); | ||
| console.log(a); | ||
| let numbers = [a, z]; | ||
| let highNumber=(Math.max(z,a)); | ||
| console.log(highNumber); | ||
|
|
||
|
|
||
| /* ----this is what i found first--- | ||
| numbers.sort(function(a, b) { return b - a; }); | ||
| var highest = numbers[0]; | ||
| console.log(highest); | ||
| */ |
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,16 @@ | ||
| // using the '%' character | ||
| {let x = 7; | ||
| x = x % 3; | ||
|
|
||
| console.log(x); | ||
|
|
||
|
|
||
| x = 7; | ||
| console.log('rest from 22/7 as integer is: '+ 22 % x); | ||
|
|
||
| let xy = 74; | ||
| console.log('rest from 150/ \'value of xy\' as integer is: ' + 150 % xy); | ||
|
|
||
| console.log('rest from \'value of xy\' / \'value of x\' as integer is: '+ xy % x); | ||
|
|
||
| } |
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,4 @@ | ||
| // find length of string | ||
| let myString = "this is a test"; | ||
| console.log(myString); | ||
| console.log(myString.length); |
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,7 @@ | ||
| //giving an integer value to variable x | ||
| let x; | ||
| console.log("the value of my variable x will be: 775"); | ||
| console.log(x); | ||
| x = 775; | ||
| console.log("the value of x will be: 775"); | ||
| console.log(x); |
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,7 @@ | ||
| //giving a string value to variable y | ||
| let y = "everything is going well"; | ||
| console.log("the value of my string will be: everything is going well"); | ||
| console.log(y); | ||
| y = "actually everything is going on the best way"; | ||
| console.log("the value of my string will be: actually everything is going on the best way"); | ||
| console.log(y); |
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 |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| ## Homework Week 2 | ||
| ## Homework Week 2 | ||
|
|
||
| ``` | ||
| Topics discussed in class this week: | ||
|
|
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,10 @@ | ||
| let favoriteAnimals = ["blowfish", "capricorn", "giraffe"]; | ||
| favoriteAnimals.push('turtle'); | ||
| console.log(favoriteAnimals); | ||
| favoriteAnimals.splice(1 , 0 , 'meerkat'); | ||
| console.log('the value of favoriteAnimals will be: ["blowfish", "meerkat", "capricorn", "giraffe", "turtle"]'); | ||
| console.log(favoriteAnimals); | ||
| console.log('The array has a length of: ' + favoriteAnimals.length); | ||
| favoriteAnimals.splice(3 , 1 ,); | ||
| console.log(favoriteAnimals); | ||
| console.log('The item you are looking for is at index: '+favoriteAnimals.indexOf('meerkat')) |
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,40 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| <meta http-equiv="X-UA-Compatible" content="ie=edge"> | ||
| <title>Document</title> | ||
| <style> | ||
| .welcome{ | ||
| width: 700px; | ||
| height: 500px; | ||
| background-color: antiquewhite; | ||
| font-family: Helvetica, sans-serif; | ||
| text-align: center; | ||
| } | ||
|
|
||
| </style> | ||
| </head> | ||
| <body> | ||
| <header class="welcome"> <h1>my app</h1></header> | ||
| <script src="strings.js"></script> | ||
| <script src="arrays.js"></script> | ||
| <script src="moreJs-1.js"></script> | ||
| <script src="moreJs-2.js"></script> | ||
| <script src="moreJs-3.js"></script> | ||
| <script src="moreJs-4.js"></script> | ||
| <script src="moreJs-5.js"></script> | ||
| <script src="moreJs-6.js"></script> | ||
| <script src="moreJs-7and8.js"></script> | ||
| <script src="moreJs-9.js"></script> | ||
| <script src="moreJs-10.js"></script> | ||
| <script src="moreJs-11.js"></script> | ||
| <script src="moreJs-12.js"></script> | ||
| <script src="moreJs-13.js"></script> | ||
| <script src="moreJs-14.js"></script> | ||
| <script src="moreJs-15.js"></script> | ||
| <script src="moreJs-16.js"></script> | ||
| <script src="moreJs-17.js"></script> | ||
| </body> | ||
| </html> |
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,4 @@ | ||
| function sum (a,b,c){ | ||
| return a+b+c ; | ||
| } | ||
| console.log(sum(5,6,7)); |
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,23 @@ | ||
| /* | ||
| Use the list of vehicles to write an advertisement. | ||
| So that it prints something like: | ||
| "Amazing Joe's Garage, we service cars, | ||
| motorbikes, caravans and bikes.". | ||
| (Hint: use a for loop.) | ||
| */ | ||
| function advertisement() { | ||
| // let vehicles = [' motorbike' , ' caravan', ' bike', ' car']; | ||
| // variable 'vehicles' is can be read from moreJs-7and8.js | ||
| // but i used it again inside of function to show you, | ||
| // and in case you can run in a html seperately. | ||
| let products = []; | ||
| for (i = 0; i < vehicles.length; i++) { | ||
| products.push(' ' + vehicles[i] + 's'); | ||
| } | ||
| let lastTwoProduct = products[products.length - 2] + ' and' + products[products.length - 1]; | ||
| console.log(lastTwoProduct); | ||
| products.splice(products.length - 2, 2); | ||
|
|
||
| console.log("Amazing Abdullah's Garage, we sell " + products.join() + ',' + lastTwoProduct + '.'); | ||
| } | ||
|
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. This is fine! Another way to do this is this:
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. I think your example automate better. Thanks. it will be in my codes today before evening |
||
| advertisement(); |
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,31 @@ | ||
| /* | ||
| Use the list of vehicles to write an advertisement. | ||
| So that it prints something like: | ||
| "Amazing Joe's Garage, we service cars, | ||
| motorbikes, caravans and bikes.". | ||
| (Hint: use a for loop.) | ||
|
|
||
| ** below moreJs-10.js ** | ||
|
|
||
| function advertisement(){ | ||
| let vehicles = [' motorbike' , ' caravan', ' bike', ' car']; | ||
| // variable 'vehicles' is can be read from moreJs-7and8.js | ||
| // but i used it again inside of function to show you, | ||
| // and in case you can run in a html seperately. | ||
| let products = []; | ||
| for(i=0; i<vehicles.length; i++){ | ||
| products.push(vehicles[i]+'s'); | ||
| } | ||
| let lastTwoProduct = products[products.length - 2] + ' and ' + products[products.length - 1] ; | ||
| console.log(lastTwoProduct); | ||
| products.splice(2, 2,); | ||
|
|
||
| console.log('Amazing Abdullah\'s Garage, we sell ' + products.join() + ',' + lastTwoProduct +'.'); | ||
|
|
||
|
|
||
| } | ||
| */ | ||
|
|
||
| vehicles.push('turck', 'scooter'); | ||
| advertisement(); | ||
|
|
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 @@ | ||
| let objCourse = {}; |
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,9 @@ | ||
| objCourse = { | ||
| teacher1: 'Rob', | ||
| teacher2: 'Philip', | ||
| teacher3: 'Unmesh', | ||
| teacher4: 'Hardit', | ||
| teacher5: 'Noer', | ||
| teacher6: 'Sander', | ||
| }; | ||
| console.log(objCourse); |
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,2 @@ | ||
| objCourse.langs = 'html, CSS, CLI, JavaScript'; | ||
| console.log(objCourse); |
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,24 @@ | ||
| let x = [1, 2, 3]; | ||
| let y = [1, 2, 3]; | ||
| let z = y; | ||
| // lets see values | ||
| console.log(x); // [1, 2, 3] | ||
| console.log(y); // [1, 2, 3] | ||
| console.log(z); // [1, 2, 3] | ||
| // we sow that values of three array are same/ equal | ||
| // now try equality and strict equality test | ||
| console.log(x==y); //false | ||
| console.log(x===y); //false | ||
| console.log(x==z); //false | ||
| console.log(x===z); //false | ||
| console.log(y==z); //true | ||
| console.log(y===z); //true | ||
| // above, i sow that only y and z equals. well of course x is a different array even the value is same. | ||
| // i understood that i did not tested equality of values!! :) | ||
|
|
||
| // now i want to see y and z assigns each other | ||
| z.push(4); | ||
| console.log(y); //[1, 2, 3, 4] | ||
|
|
||
| // we can see values of x and z equals | ||
| console.log(x[0,1,2]==z[0,1,2]); //true |
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,16 @@ | ||
| let o1 = { foo: "bar" }; | ||
| let o2 = { foo: "bar" }; | ||
| let o3 = o2; | ||
| o1.foo2 = 'pub'; | ||
| console.log(o3); //o1 doesnt change o3 | ||
| console.log(o1); // {foo: "bar", foo2: "pub"} o1 only changes itself | ||
|
|
||
| o3.foo2 = 'car'; | ||
| console.log(o2); //{foo: "bar", foo2: "car"} , o3 changes o2 | ||
|
|
||
| delete o2.foo2; | ||
| console.log(o3); //{foo: "bar"} , o2 changes o3 | ||
|
|
||
| //we understand in the example above that | ||
| // order (o3 = o2 or o2 = o3) doesnt matter. | ||
|
|
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,6 @@ | ||
| let bar = 42; | ||
| typeof typeof bar; | ||
|
|
||
| console.log(typeof bar); // number the type of variable 'bar' so pure 42 is 'number' | ||
| console.log(typeof typeof bar); // string / 'number' is a word. its text. its string! | ||
| // because we ask for type of (type of 'bar) = ' number ' |
Oops, something went wrong.
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.
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.
nice!
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.
thanks.