forked from HackYourFuture/JavaScript1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathalaa.js
More file actions
94 lines (92 loc) · 2.52 KB
/
alaa.js
File metadata and controls
94 lines (92 loc) · 2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
//1
console.log('Hallo', 'wereld!'); // Dutch;
console.log('hola', 'mundo!'); //spanish
console.log('مرحبا', 'العالم!'); //Arabic
//2
console.log("I'm awesome"); // should use two quotations instead of one
//3
const x;
console.log('the value of my variable x will be: undefined');
x = 7; // initialize the value of x
console.log('the value of my variable x will be 7');
console.log(x);
//4
let y;
y = 'hyf';
console.log('the value of y will be :hyf');
console.log(y);
let y = 'code';
console.log('the value of y will be :code');
console.log(y);
//5
const z = 7.25;
console.log(z);
const a = Math.floor(z);
console.log(a);
const max = Math.max(z, a);
console.log(max);//math.floor() rounds the number generated by math.random() down to the last integer. math round used to round a number to its nearest integer
//6
const myLibraries = [];
console.log('the value of the the array is []');
const myFavoriteAnimals = ['dogs', 'elephants', 'turtles', 'cats'];
console.log(myFavoriteAnimals);
const newLength = myFavoriteAnimals.push('baby pig');
console.log(newLength);
//7
const len = myString.length;
console.log(len);
//8
const a = 4;
console.log('the value of my const a is :4');
const b = 'dog';
console.log('the value of my variable animal is :dog');
const c = true;
console.log('the value of my variable age28 is : true');
const d = [1, 2, 3, 4];
console.log('the value of variable a is:' + 'number');
console.log('the value of variable b is :' + 'string ');
console.log('the value of c variable is : ' + 'boolean');
console.log('the value of variable d is :' + 'array ');
const typeA = 4;
typeof typeA; //number
const typeB = 'dog';
typeof typeB; //string
const typeC = true;
typeof typeC; // boolean
const typeD = [1, 2, 3, 4];
typeof typeD; // number
console.log(typeof typeA);
console.log(typeof typeB);
console.log(typeof typeC);
console.log(typeof typeD);
if (typeA === typeB, typeA === typeC || typeA === typeD) {
console.log('same type');
}
if (typeA != typeB, typeA != typeC || typeA != typeD) {
console.log('Not the same type');
}
//9
let x = 7;
x = x % 3;
console.log('the value of x is :1 ');
let y = 8;
y = y % 6;
console.log(2);
let z = 4;
z = z % 3;
console.log(1);
let b = 11;
b = b % 2;
console.log(1);
//10
let arr = [1, 'dog', 32, 'baby']; // you can add different types of values in one array.
// you can compare infinities
let x = "Not in Eyad's world";
var b = 6 / 0;
let c = 10 / 0;
if (b === c) {
console.log(true); // it shows true then you can compare infinities
}
let x = 4;
let y = 0;
console.log(x / y); // it shows infinity