-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.js
More file actions
137 lines (123 loc) · 2.84 KB
/
app.js
File metadata and controls
137 lines (123 loc) · 2.84 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
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
"use strict"
let user=prompt('please enter your name ?')
alert("welcome" + user);
let score=0;
function name()
{
let nameq=prompt('do you name owner the website ?').toLowerCase();
switch(nameq){
case 'yes':
alert("the answer is saja");
console.log("saja");
break;
default:
alert("ok no problem ");
console.log("no problem ");
score++
break;
}
}
name();
function age()
{
let myage=prompt('do you age owner the website ?').toLowerCase();
switch(myage){
case 'yes':
alert("the answer is 27");
console.log("the answer is 27");
break;
default:
alert("ok no problem");
console.log("no problem ");
score++;
break;
}
}
age();
function maj()
{
let major=prompt('do you major study in the unieversity owner the website ?').toLowerCase();
switch(major){
case 'yes':
alert("the answer is computer science ");
console.log("computer science ");
break;
default:
alert("ok no problem ");
console.log("no problem ");
score++;
break;
}
}
maj() ;
function year1(){
let year =prompt('do you know when graduated from unieversity owner the website ?')
switch(year){
case 'yes':
alert("the answer is 2016");
console.log("2016");
break;
default:
alert("ok no problem ");
console.log("no problem ");
score++;
break;
}
}
year1() ;
function job1()
{
let job =prompt('do you know job before year worked owner the website ?').toLowerCase();
switch(job){
case 'yes' :
alert("the answer is teacher");
console.log("tachert");
alert(" thank you for answering question " + user)
break;
default:
alert("ok no problem");
console.log("no problem");
score++;
alert("thank you for answering question" + user )
break;
}
}
job1();
function numselect(){
let numberselect = 3;
let attemptnumber = Number(prompt('how many times do you want guess'));
for (let attempt = 1; attempt <= attemptnumber; attempt++) {
let number = parseInt(prompt('can you guess my number please '));
if (number === numberselect) {
alert('right answer');
break;
} else if (number > numberselect) {
alert('too high');
} else if (number < numberselect) {
alert('too low');
score++;
}
}
} numselect();
alert('the right answer is 3');
function country()
{
let namecountries = ['jordan', 'syria', 'lebanon', 'kuwait'];
let flag = false;
for (let attempt = 1; attempt <= 6; attempt++) {
let userAnswer = prompt('what is my best name countries?');
for (let i = 0; i < namecountries.length; i++) {
if (userAnswer === namecountries[i]) {
alert('right');
score++;
flag = true;
break;
}
}
if (flag === true) {
break;
}
}
} country();
alert("good job" + user);
alert(' your score is ' + score);