-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
305 lines (164 loc) · 4.67 KB
/
app.js
File metadata and controls
305 lines (164 loc) · 4.67 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
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
// Q : 1
// const firstName = prompt("");
// const lastName = prompt("");
// const add = firstName + " " +lastName ;
// console.log(add)
// DONE
// Q : 2
// const head = document.querySelector("h2")
// const userValue = prompt("enter your fav mobile model");
// const add = userValue.length;
// head.innerHTML = "MY FAV MOBILE PHONE IS :" + " " +userValue+ " " +add;
// DONE
// Q : 3
// const head = document.querySelector("h2")
// const word = prompt("")
// const add = word.indexOf("n");
// head.innerHTML = word+ " " + add;
// DONE
// Q : 4
// const head = document.querySelector("h2")
// const word = prompt("")
// const add = word.indexOf("l");
// head.innerHTML = word+ " " +add
// DONE
// Q : 5
// const word = "pakistani";
// const add =word.charAt(3)
// console.log("character of index 3:"+ " " + add)
// DONE
// Q : 6
// const word = "iqbal";
// const words = "khan";
// const add =word.concat( " " +words );
// console.log(add)
// DONE
// Q : 7
// const city = "karachi";
// const nameCity = city.replace( "ali", "iqbal" );
// console.log("after replacement" +nameCity)
// DONE OR NOT DONE
// Q : 8
// const massage= "ali and iqbal are best friends. they are playing crickets and football together";
// const newMassage = massage.replace(/and/g, "&");
// console.log(newMassage)
// DONE
// Q : 9
// const str = "472"
// const num = parseInt(str);
// console.log( "value" + str)
// console.log( "type" + typeof str)
// console.log( "value" + num)
// console.log( "type" + typeof num)
// DONE
// Q : 10
// function submit(url){
// let domain = url.split("www.").pop();
// return domain;
// }
// let url = "www.facebook.com";
// let domain = submit(url);
// console.log("Domain:",domain)
// NOT DONE
// Q : 11
// const userValue = prompt("Enter your username");
// const add =userValue.toUpperCase();
// console.log(add)
// DONE
// Q : 12
// const userValue = prompt("Enter your username");
// let add = userValue.toLowerCase();
// console.log(add)
// DONE
// Q : 13
// const userName = prompt("Enter your");
// const add = userName.charAt(0).toUpperCase() + userName.slice(1).toLowerCase();
// console.log(add)
// DONE
// Q : 14
// const num =35.36;
// const numString = num.toString();
// const result = numString.replace(".", "");
// console.log("number",num);
// console.log("result",result);
// DONE
// Q : 15
// const a = prompt("")
// const b = prompt("")
// let add = a + b;
// console.log("a is",a)
// console.log("b is",b)
// console.log(add);
// DONE
// Q : 16
// const a = prompt("")
// const b = prompt("")
// let sub = a - b;
// console.log("a is",a)
// console.log("b is",b)
// console.log(sub)
// DONE
// Q : 17
// const userName = prompt("Enter your");
// if(userName.includes(".")||userName.includes(",")||userName.includes("!")){
// alert("Please enter a valid user name without any special characters");
// }else{
// alert("Your user name is valid");
// }
// DONE
// Q : 18
// const arr = ["apple" ,"banana" ,"mango" , "grapes" ,"pepperoni"]
// const userSearch = prompt("please select your favorite fruit")
// let isFound = false;
// for(let i = 0; i < arr.length; i++){
// if(arr[i].toLowerCase() === userSearch.toLowerCase()){
// isFound = true;
// break;
// }
// }
// if(isFound){
// console.log("Your favorite fruit is " + userSearch);
// }else{
// console.log("Your favorite fruit is not found");
// }
// DONE
// Q : 19
// const first = prompt("please enter first string value")
// const second = prompt("please enter second string value")
// if(first > second){
// alert("the first string is greater than the second string")
// }else if(first < second){
// alert("the first string is less than the second string")
// }else{
// alert("the first string is equal to the second string")
// }
// DONE
// Q : 20
// const password = prompt("enter your password");
// var alphabet = /[a-zA-Z]/.test(password);
// var numbers = /[0-9]/.test(password);
// var startNumber = /^[0-9]/.test(password);
// var passwordLength = password.length >= 6;
// if(alphabet && numbers && ! startNumber && passwordLength){
// alert("your password is valid")
// }else{
// alert("your password is not valid")
// }
// DONE
// Q : 21
// const str = "university of karachi"
// const broke = str.split("")
// for(let i = 0; i< broke.length; i++){
// console.log(broke[i] + " ")
// }
// DONE
// Q : 22
// const userInput ="pakistan"
// const lastCharacter = userInput.charAt(userInput.length-1)
// console.log("last character of input :" + " " +lastCharacter)
// DONE
// Q : 23
// not complete
// Q : 24
// var str = "pakistan"
// not complete