diff --git a/Week1/arrays.js b/Week1/arrays.js new file mode 100644 index 000000000..124d0780e --- /dev/null +++ b/Week1/arrays.js @@ -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); diff --git a/Week1/checkType.js b/Week1/checkType.js new file mode 100644 index 000000000..ba723023c --- /dev/null +++ b/Week1/checkType.js @@ -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') +} + diff --git a/Week1/compairingInfinities.js b/Week1/compairingInfinities.js new file mode 100644 index 000000000..34d90f66d --- /dev/null +++ b/Week1/compairingInfinities.js @@ -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 */ diff --git a/Week1/helloInDifLang.js b/Week1/helloInDifLang.js new file mode 100644 index 000000000..791046e23 --- /dev/null +++ b/Week1/helloInDifLang.js @@ -0,0 +1,3 @@ +console.log ('hello world'); //english +console.log ('здравствуйте мира'); //russian +console.log('merhaba dunya'); //turkish diff --git a/Week1/index.html b/Week1/index.html new file mode 100644 index 000000000..bbac991aa --- /dev/null +++ b/Week1/index.html @@ -0,0 +1,24 @@ + + + + + + + Hack Your Future + + +

Hello world!

+ + + + + + + + + + + + + \ No newline at end of file diff --git a/Week1/inlineQuote.js b/Week1/inlineQuote.js new file mode 100644 index 000000000..ec5ba25cf --- /dev/null +++ b/Week1/inlineQuote.js @@ -0,0 +1 @@ +console.log('I\'m awesome'); \ No newline at end of file diff --git a/Week1/numberRounding.js b/Week1/numberRounding.js new file mode 100644 index 000000000..a32c6fdb1 --- /dev/null +++ b/Week1/numberRounding.js @@ -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); +*/ diff --git a/Week1/percentageCharacter.js b/Week1/percentageCharacter.js new file mode 100644 index 000000000..d7eca0895 --- /dev/null +++ b/Week1/percentageCharacter.js @@ -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); + +} \ No newline at end of file diff --git a/Week1/stringtLenght.js b/Week1/stringtLenght.js new file mode 100644 index 000000000..e4fbb33bf --- /dev/null +++ b/Week1/stringtLenght.js @@ -0,0 +1,4 @@ +// find length of string +let myString = "this is a test"; +console.log(myString); +console.log(myString.length); \ No newline at end of file diff --git a/Week1/varXInteger.js b/Week1/varXInteger.js new file mode 100644 index 000000000..cbc72f7c5 --- /dev/null +++ b/Week1/varXInteger.js @@ -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); diff --git a/Week1/varYString.js b/Week1/varYString.js new file mode 100644 index 000000000..5b5781447 --- /dev/null +++ b/Week1/varYString.js @@ -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); diff --git a/Week2/MAKEME.md b/Week2/MAKEME.md index aa83c5bc4..9ca8ae250 100644 --- a/Week2/MAKEME.md +++ b/Week2/MAKEME.md @@ -1,4 +1,4 @@ -## Homework Week 2 +## Homework Week 2 ``` Topics discussed in class this week: diff --git a/Week3/arrays.js b/Week3/arrays.js new file mode 100644 index 000000000..d87833aaa --- /dev/null +++ b/Week3/arrays.js @@ -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')) \ No newline at end of file diff --git a/Week3/index.html b/Week3/index.html new file mode 100644 index 000000000..2e96663bb --- /dev/null +++ b/Week3/index.html @@ -0,0 +1,40 @@ + + + + + + + Document + + + +

my app

+ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Week3/moreJs-1.js b/Week3/moreJs-1.js new file mode 100644 index 000000000..cf0356919 --- /dev/null +++ b/Week3/moreJs-1.js @@ -0,0 +1,4 @@ +function sum (a,b,c){ + return a+b+c ; +} +console.log(sum(5,6,7)); \ No newline at end of file diff --git a/Week3/moreJs-10.js b/Week3/moreJs-10.js new file mode 100644 index 000000000..d0d01eac6 --- /dev/null +++ b/Week3/moreJs-10.js @@ -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 + '.'); +} +advertisement(); diff --git a/Week3/moreJs-11.js b/Week3/moreJs-11.js new file mode 100644 index 000000000..7df1ac7e0 --- /dev/null +++ b/Week3/moreJs-11.js @@ -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> **last rows added** +i am looking for feedback... +*/ + +console.log("yes"); + +// ** last rows + +console.log ( (3 == 3) ? 'yes' : 'no'); + +// :))) i just now understand challange. is ti true? diff --git a/Week3/moreJs-6.js b/Week3/moreJs-6.js new file mode 100644 index 000000000..c0589b9ff --- /dev/null +++ b/Week3/moreJs-6.js @@ -0,0 +1,23 @@ +/* +Create a function called vehicle, like before, + but takes another parameter called age, + so that vehicle("blue", 1, 5) + prints 'a blue used car' +*/ + +function vehicle(color, type, age) { + let types = [' car', ' motorbike', 'truck', 'bus']; + if (type > 0 && type <= types.length) { + console.log('a ' + color + ' ' + condition(age) + types[type - 1]); + } else { + console.log('!NO SUCH VEHICLE HERE'); + } +} +function condition(age) { + if (age < 2) { + return 'new '; + } else { + return 'used '; + } +} +vehicle('red', 3, 3); diff --git a/Week3/moreJs-7and8.js b/Week3/moreJs-7and8.js new file mode 100644 index 000000000..50c84912d --- /dev/null +++ b/Week3/moreJs-7and8.js @@ -0,0 +1,9 @@ +/* +7- Make a list of vehicles, you can add "motorbike", "caravan", "bike", or more. + +8- How do you get the third element from that list? +*/ + + +let vehicles = ['motorbike' , 'caravan', 'bike', 'car']; +console.log (vehicles[2]); // bike diff --git a/Week3/moreJs-9.js b/Week3/moreJs-9.js new file mode 100644 index 000000000..241594e70 --- /dev/null +++ b/Week3/moreJs-9.js @@ -0,0 +1,24 @@ +/* +Change the function vehicle to use the list of question 7. + So that vehicle("green", 3, 1) prints "a green new bike". +*/ + +function vehicle(color, type, age) { + 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. + if (type > 0 && type <= vehicles.length) { + console.log('a ' + color + ' ' + condition(age) + vehicles[type - 1]); + } else { + console.log('!NO SUCH VEHICLE HERE'); + } +} +function condition(age) { + if (age < 2) { + return 'new '; + } else { + return 'used '; + } +} +vehicle('green', 5, 1); diff --git a/Week3/strings.js b/Week3/strings.js new file mode 100644 index 000000000..ac60890a7 --- /dev/null +++ b/Week3/strings.js @@ -0,0 +1,6 @@ +let myString = "hello,this,is,a,difficult,to,read,sentence"; +console.log(myString); +for (i=0; i<7; i++){ + myString = myString.replace(',' , ' '); +} +console.log(myString); \ No newline at end of file