Skip to content
This repository was archived by the owner on May 14, 2024. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Week1/homework/js-exercises/exercise2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
'use strict';
console.log("I'm awesome")
Comment thread
AmnaAhmad marked this conversation as resolved.
9 changes: 9 additions & 0 deletions Week1/homework/js-exercises/exercise4.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use strict';
let myString = 'Amna Ahmad'; //1
console.log('the value is the string above'); //2
console.log(myString); //3
myString = 'a new string'; //4
console.log('the new string'); //5
console.log(myString);


7 changes: 7 additions & 0 deletions Week1/homework/js-exercises/exercise5.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict';
const z = 7.25;
console.log(z);
const a = 7;
console.log(a);
const biggistNumber = a > z ? a : z;
Comment thread
AmnaAhmad marked this conversation as resolved.
console.log(biggistNumber);
12 changes: 12 additions & 0 deletions Week1/homework/js-exercises/exercises10.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
'use strict';
const firstArray = ["good", 26, true, {name: "Amna"}];
const secondArray = ["beter", 38, false, "why?", "Who", "what", {frinds: "Hala"}];

console.log('The length of the first array is ...' + firstArray.length);
console.log('The length of the second array is ...' + secondArray.length);

if(firstArray.length == secondArray.length){
console.log("They are the same!")
}else{
console.log("Two different sizes");
};
8 changes: 8 additions & 0 deletions Week1/homework/js-exercises/exercises3.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'use strict';

let numberX; // 1
console.log('undefined, because the variable is not assigned a value'); //2
console.log(numberX); //3
numberX = 10; //4
console.log('10, because now it has been assigned a value 10'); //5
console.log(numberX); //6
9 changes: 9 additions & 0 deletions Week1/homework/js-exercises/exercises6.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use strict';
const paragraphs = []; //1
console.log('I have to show an empty arrey'); //2
console.log(paragraphs); //3

const favoriteAnimals = ['fish ', 'butterfly ', ' rabbit ' ]; //4
console.log(favoriteAnimals); //5
favoriteAnimals.push('Piglet');
console.log(favoriteAnimals);
3 changes: 3 additions & 0 deletions Week1/homework/js-exercises/exercises7.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
'use strict';
const mySentence = "Programming is so interesting!";
console.log(mySentence.length);
69 changes: 69 additions & 0 deletions Week1/homework/js-exercises/exercises8.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
'use strict';
const name = 'Amna'; //string
Comment thread
AmnaAhmad marked this conversation as resolved.
const lastName = 'Ahmad';//string

const firstObject = {
fatherName : 'Musleh',
motherName: 'Fatima',
brotherName:'Sagvan'
}//object
const secondObject = {
bigSister : 'Torfa',
secondSister: 'Nesrin',
therdSister:'Janda'
}//object

console.log(name);
console.log(lastName);
console.log(firstObject);
console.log(secondObject);


//first conditional

if(typeof name == typeof lastName) {
console.log('the both of name and lastName are string');
} else{
console.log('the both of name and lastName are not string');
}
//socond conditional

if(typeof firstObject == typeof secondObject) {
console.log('the both of firstObject and secondObject are string');
} else{
console.log('the both of firstObject and secondObject are object');
}
//therd conditional
if(typeof name == typeof secondObject) {
console.log('the both of name and secondObject are string');
} else{
console.log('the name is string and secondObject is object');
}


//fourth conditional
if(typeof lastName == typeof firstObject) {
console.log('all of this are not different');
} else{
console.log('lastName is string but first object is an object ');
}

//fivth conditional

if(typeof name == typeof firstObject) {
console.log('all of this are not different');
} else{
console.log('name is string but firstObject is an object');
}
//sixth conditional
if(typeof lastName == typeof secondObject) {
console.log('all of this are not different');
} else{
console.log('lastName is string but secondObject is an object');
}


console.log(typeof name);
console.log(typeof firstObject);

console.log(typeof name, typeof firstObject);
Comment thread
AmnaAhmad marked this conversation as resolved.
29 changes: 29 additions & 0 deletions Week1/homework/js-exercises/exercises9.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
'use strict';
let x = 7;
x = x % 3;
console.log(x);
/*the answer is 1 . the solution is
7 / 3 = 2 ;
2 * 3 = 6 ;
7 - 6 = 1;
*/

let y =21;
y = y %4;
console.log(y);
/*the answer is 1 . the solution is
21 / 4 = 5 ;
5 * 4 = 20 ;
21 - 20 = 1;
*/

let z = 13;
z = z % 2 ;
console.log(y);
/*the answer is 1 . the solution is
13 / 2 = 6 ;
6 * 2 = 12 ;
13 - 12 = 1;
*/


11 changes: 11 additions & 0 deletions Week1/homework/js-exercises/logHallo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
'use strict';
console.log('Hello ' + 'World'); // English
console.log('Halo ' + 'Mundo'); //Spanish
console.log('こんにちは ' + '世界'); //日本人
console.log('Bongu ' + 'Tad-dinja'); // Maltese
console.log('שלום ' + 'עולם'); // Hebrew
console.log('مرحبا ' + 'العالمية'); // Arabic
console.log('Hej ' + 'Verden'); // Danish
console.log('алло ' + 'Мир'); // Russian
console.log('هالو ' + 'ودرلد'); // Persian
console.log('slav ' + 'Dinya'); // Kurdish