forked from israaothman/JsDemo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appChapter2.js
168 lines (120 loc) · 2.84 KB
/
appChapter2.js
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
// conditions:
// mathmatical operations
// +
// -
// *
// /
// x = 5 assignment operation
// x + y == 5 Compression
// 5 === "5" Compression with datatype console.log(5 == "5");
// console.log(5 == "5");
// true
// console.log(5 === "5");
// false
// logical operatores
// and &&
// or ||
// not !
// <
// >
// <=
// >=
// let x = 5;
// let y = 5;
// if (x > y) {
// console.log("x is bigger than y ")
// }
// if(x>y){
// console.log("x is bigger than y ")
// }else{
// console.log("y is bigger than x")
// }
// if (x > y) {
// console.log("x is bigger than y ")
// } else if (x < y) {
// console.log("y is bigger than x")
// } else {
// console.log("y is equal to x")
// }
// let username = "Ahmad";
// let age = 28;
// if (username == "Ahmad" && age == 25) {
// alert("Welcome Ahmad")
// } else if (username == "Esraa" || age == 20) {
// alert("Welcoeme Esraa ")
// } else {
// alert("Welcome")
// }
// 90-100 A
// 80-89 B
// 70-79 C
// 69 and below F
// Switch
// let mark = 88;
// let result;
// switch (true) {
// case (mark <= 100 && mark >= 90):
// result = "A"
// break;
// case (mark < 90 && mark >= 80):
// result = "B"
// break;
// case (mark < 80 && mark >= 70):
// result = "C"
// break;
// default:
// result = "F";
// }
// switch(mark){
// case 88 :
// result = "B";
// break;
// }
// let z = "0";
// switch (z) {
// case 0:
// text = "Off";
// break;
// case 1:
// text = "On";
// break;
// default:
// text = "No value found";
// }
// console.log(result);
// console.log("welcome")
// console.log("welcome")
// console.log("welcome")
// console.log("welcome")
// console.log("welcome")
// for (let i = 0; i < 5; i++) {
// console.log(i);
// }
// let user = prompt("Enter your name ");
// while(user != "esraa"){
// user = prompt("Enter your name ");
// }
// let j = 0;
// while (j < 5) {
// console.log("welcome j");
// j++;
// }
// let user;
// do {
// user = prompt("Enter your name ");
// } while (user != "esraa")
// for (let i = 0; i < 5; i++) {
// if(i == 3 ) continue;
// console.log(i);
// }
// for (let i = 0; i < 5; i++) {
// if(i == 3 ) break;
// console.log(i);
// }
// Task :
// - Create javaScript file called `app.js` and link it with `index.html`.
// - When the home page is running you will do the following requirements in `app.js`:
// - Ask the user to enter his/her name as input. keep asking until he/she enters a name
// - Ask the user to enter his/her gender as input. The answer should be either (male or female).
// - Ask the user to enter his/her age as input and alert the user if the age is less than or equal to zero.
// - Alert a welcoming message with the name of the user