-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
171 lines (150 loc) · 3.58 KB
/
app.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
166
167
168
169
170
171
'use strict';
let result = 0;
let name1 = prompt('enter your name please');
alert('you are welcome ' + name1);
function q1()
{
let name2 = prompt('Is my name zeinab? (YES/NO/Y/N)');
switch (name2.toUpperCase()) {
case 'YES':
case 'Y':
result = result + 1;
alert('whak about you ?');
console.log(name2);
break;
case 'NO':
case 'N':
alert('nice try !!!');
console.log(name2);
break;
}
}
function q2(){
let size = prompt('Am I to Short? (YES/NO/Y/N)');
switch (size.toUpperCase()) {
case 'YES':
case 'Y':
alert('Wrong');
console.log(size);
break;
case 'NO':
case 'N':
result = result + 1;
alert('You guessed it');
console.log(size);
break;
}
}
function q3 () {
let major = prompt('Is my major an accountant? (yes/no/y/n)');
switch (major.toLowerCase()) {
case 'yes':
case 'y':
result = result + 1;
alert('It is Correct !');
console.log(major);
break;
case 'no':
case 'n':
alert('Try Again!!');
console.log(major);
break;
}
}
function q4(){
let talent = prompt('Do I writer? (yes/no/y/n)');
switch (talent.toLowerCase()) {
case 'yes':
case 'y':
result = result + 1;
alert('Let is guess !!!');
console.log(talent);
break;
case 'no':
case 'n':
alert('Wrong choice !!!');
console.log(talent);
break;
}
}
function q5(){
let color = prompt('Is my favourite color green ? (yes/no/y/n)');
switch (color.toLowerCase()) {
case 'yes':
case 'y':
alert('Did you like it ?');
console.log(color);
break;
case 'no':
case 'n':
result = result + 1;
alert('But I like it!');
console.log(color);
break;
default:
console.log('default');
alert('you lost 1 mark');
function username(){
let username = prompt ('Hello, could you please enter your name ');
console.log(username);
console.log(typeof username);
}
username();
function age(){
let age = prompt ('Hello, could you please enter your name ' );
console .log(age);
console.log( typeof age );
}
age();
}
}
function q6(){
alert('You have 4 guesses, guess from 1-100');
let answer = 57;
let guess = prompt('what is my wight ? ( Please enter a number only )');
for (let i = 0; i < 3; i++) {
if (answer === Number(guess))
{
alert('Your guess is true');
result = result + 1;
break;
} else if (guess > answer){
guess = prompt('you are very hight Try Again');
}
else if (guess < answer){
guess = prompt('you are very low Try Again');
}
console.log(Number(i));
if (i===2){
alert('you are false and this is true answer '+answer);
}
}
}
function q7(){
let mymove = ['Bad Boys for Life', 'Birds of Prey', 'Tenet', 'The Invisible Man', 'The Call of the Wild', 'jungle', 'fast furious', 'the notebook', 'rust creek', 'bloodsh'];
for (let a = 0; a < 6; a++) {
let move = prompt('can you guess any of my moves? \n you have (' + (6 - a) + ') attempit');
for (let i = 0; i < mymove.length; i++) {
if (move.toLowerCase() === mymove[i]) {
result = result + 1;
alert('you gused it ');
console.log('hello');
i = mymove.length;
a = 6;
}
}
}
let allmove;
for (let i = 0; i < mymove.length; i++) {
allmove = allmove + '\n' + mymove[i];
}
alert('my move are \n' + allmove);
}
q1();
q2();
q3();
q4();
q5();
q6();
q7();
alert('this is your mark ( ' + result + ' )');