-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
467 lines (361 loc) · 13 KB
/
index.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
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
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
//-------------------------Q1.Personal Name
/*let person_name='afzaal';
console.log(`"Hello ${person_name} ,would you like to to learn some JavaScript Today?"`)*/
//-------------------------End Program
//-------------------------Q2.Name Cases
/*let User_Name="Afzaal Ahmad";
console.log(User_Name.toUpperCase());
console.log(User_Name.toLowerCase());
console.log(User_Name);*/
//-----------------------End Program
//-----------------------Q4. Famous Quote
/*let Famouse_Person="Elon Musk";
let Quote= `${Famouse_Person} once said,"Patience is a virtue ,and i'm learning patience".`;
console.log(Quote);*/
//------------------------End Program 4
//------------------------ Q5. Famous Quote 2
/*let Famouse_Person="Elon Musk";
let massage=`${Famouse_Person}once said,"Patience is a virtue ,and i'm learning patience".`;
console.log(massage);*/
//-----------------------End Program 5
//-----------------------Q6.stripping Names
/* let persons_name=" Afzaal ahmad ";
console.log(persons_name);
console.log(persons_name.trim());*/
//------------------------End Program 6
//------------------------Q7.Number eight
//let number=5+3;
//console.log(number);
/*let number=10-2;
console.log(number)
let number=2*4;
console,log(number);*/
//------------------------End Program 7
//-------------------------8
/*console.log(5+3);
console.log(5+3);
console.log(5+3);
console.log(5+3);
*/
//----------------------Q9.Favorite Number
/*
let favorite_number=8;
let massage=`my favorite number is ${favorite_number}`;
console.log(massage);*/
//--------------------End program 9
//--------------------Q11.Names
/*let friends=["mohsin","ali","hassan"];
console.log(friends[0]);
console.log(friends[1])
console.log(friends[2]);*/
//----------------------------End Program 11
//-------------------------Q12.Greetings
/*let friends=["mohsin","ali","hassan"];
console.log(friends[0]+ " "+'is my best friend');
console.log(`${friends[1]} is my best friend`);
console.log(`${friends[2]} is my best friends`);*/
//---------------------------End of program 12
//---------------------------Q13.0wn array
/* let list=["i would like to programm sultions","i would like to walk early morning","i would like to learning tech"];
console.log(list);*/
//-----------------------End of program 13
//--------------------------Q14.Guest List
/* let guest=["mohsin","ali","bilal"];
guest.map((invite)=>{
console.log(`${invite} you are invited for dinner.`)
})
//---------------------------End of program 14
//-------------------Q15..changing guest list
let chang_guest=guest;
chang_guest[2]="hassan";
chang_guest.map((invite)=>{
console.log(`${invite} you are invited for dinner.`)
})
*/
//----------------------End of program 15
//---------------------Q16.More Guest add three
/*let guest=["mohsin","ali","bilal"];
guest.push("tabish","abdullah","junied");
guest.map((invited)=>{
console.log(`${invited} i arrange a big dinner table.`)
});
// add new friend in the biginning
guest.unshift('zeeshan');
//-----------------------Q-17 start
console.log(guest);
console.log(`${guest[5]} soory bro you are removed`);
console.log(`${guest[4]} soory bro you are removed`);
console.log(`${guest[3]} soory bro you are removed`);
console.log(`${guest[2]} soory bro you are removed`);
*/
//--------------------------Q17 end
//--------------------Q18.Seeing the world
/*let favorite_places=["turkey","dubia","madina","japan","usa"];
console.log(favorite_places);
console.log(favorite_places.sort())
console.log(favorite_places.reverse());
console.log(favorite_places.reverse());*/
//--------------------------End Program 18
//----------------------Q19.Dinner Guests finding lenght
/*let friends=['hassan','ali','zeeshan']
console.log(friends.length)*/
//---------------------------Q20 store something in object.
/*let mountaines=["h2","nanga parbat","broad peak"];
let river=["indus river","chenab river","jhelum river"];
let cities=["lahore","islamabad","rawalpindi","multan"];
let combination=[mountaines,river,cities];
console.log(combination);*/
//---------------------------------End Programm 20
//--------------------------------Q21.Creats object and print
/*let car={
company:"Honda",
model:2022,
color:'black',
avaible:true
}
console.log(car);*/
//-------------------------End Program 21
//------------------------------Q23. Condition test
/*let car ='civic';
let avaible=car==='civi'?'avaible':'not avaible';
console.log(avaible);
let color='red';
let check = color==='red'?'danger':'safe';
console.log(check);
console.log(car=='civic');
let number=233;
let string=233;
console.log(number==string);
let num=35;
let num2='35'
console.log(num==num2);
console.log(num===num2);
let str='16';
let int=16;
console.log(str==int);
console.log(str===int);*/
//---------------End program 23.
//------------------Q24.More condition test
/*let age=16;
console.log(age===23)
let color='green';
console.log(color==='red');
console.log(color==='green');
let status=true;
console.log(status!=true);
console.log(status===true);
let num=23;
console.log(num>40);
let employ={
age:23,
gender:'female'
};
if(employ.age>18 && employ.gender==='male'){
console.log('the offer is only for girls')
}else{
console.log('ladies first please')
}
let employes={
designation:'manager',
name:'afzaal',
age:23
,
designation:'supervisor',
name:'ali '
}
if(employes.designation='manager'&& employes.name==='afzaal'){
console.log('you are wellcome sir')
}else{
console.log('sir ali is busy now')
}*/
//---------------------End Programm 24
//----------------------Q25 Alien Color
/*let alien_color='red';
let check=alien_color==='green'?'player just earned 5 points':'Fails will have no output';
console.log(check);*/
//----------------------End Program 25
//------------------------Q26. Alien Color 2
/*let alien_color='green';
if(alien_color=='green'){
console.log('player just earned 5 pint')
}else if(alien_color!='green'){
console.log('player just earned 10 points')
}else if(alien_color==="pink"){
console.log('try next time')
}*/
//-----------------------End OF Program 26
//-------------------------Q27 Alien Color 3
/*let alien_color='yellow';
if(alien_color==='green'){
console.log('player just earned 5 pint')
}else if(alien_color==='yellow'){
console.log('player just earned 10 points')
}else if(alien_color==="red"){
console.log('player earned 15 points')
}
*/
//----------------------------End Of Programm 27
//---------------------------------Q28 Stage of life
/*let person_age=66;
if(person_age<2){
console.log('person is baby');
}else if(person_age <=2 && person_age<4){
console.log('person is toddler');
}else if(person_age>=4 && person_age<=13){
console.log('person is kid');
}else if(person_age>=13 && person_age<=20){
console.log('person is teenagar')
} else if(person_age>=20&& person_age<=65){
console.log('person is adult')
} else if(person_age>65){
console.log('person is elder');
}*/
//--------------------- End Of Program Q28
//--------------------------Q29.Favorite Fruit
/*let favorite_fruites=['apple','cherry','orange','manogo','banana'];
if(favorite_fruites.indexOf('apple')!==-1){
console.log('fruite is available');
}else{
console.log('fruite is not available');
}*/
//--------------------------End Of Program Q29
//--------------------------------Q29 Part 2
/*let favorite_fruites=['apple','mango','cherry'];
if(favorite_fruites.indexOf('cherry')!==-1){
console.log('you really like cherry!')
}*/
//----------------------------End Of Program 29
//-----------------------------Q30 Hello Admin
/*let User_Name=['admin','ali','hassan','mohsin','tabish'];
for(let i=0;i<=User_Name.length;i++){
console.log(`${User_Name[i]} you are welcome`)
}
if(User_Name.indexOf('admin')!==-1){
console.log('Hello admin would you like to see a status report')
}
//-----------------------------------End Of Program Q30
//-----------------------------------Q30 part 2
/*let User_Name=['admin','ali','hassan','mohsin','tabish'];
for(let i=0;i<=User_Name.length;i++){
}
if(User_Name.indexOf('admin')!==-1){
console.log('Hello admin would you like to see a status report')
}else{
console.log('Hello eric ,thank you for logging in again')
}*/
//-----------------------------------------End Of Program Q30 part 2
//---------------------------------Q31 no user
/*(let User_Name=[];
if(User_Name.length===0){
console.log('we need to find some users')
}*/
//-----------------------------End Of Program 31
//------------------------------- Q32. Checking Usernames
/*let current_user=['sarfarz','awaise','tahir','khawar','afzaal'];
let new_user=['sarfarz','awaise','mudasser','ali','tahir'];
for(let i=0;i<=new_user.length;i++){
if(new_user=current_user.indexOf('sarfarz')!==-1){
console.log('you need to enter new yousername')
}
}*/
//-----------------------------End Of Programm Q32
//-----------------------------Q33. Ordinal Number
//------------------------------Q34 pizza
/*let favorite_piza=['pepperoni','chiken','cheese'];
for(let i=0;i<=favorite_piza.length;i++){
console.log(favorite_piza[i]);
}
console.log(`i really love pizza` )*/
//---------------------------------End of program 34
//----------------------------------Q35 Animals
/*let animals=['dog','cat','rabit'];
for(let i=0; i<animals.length;i++){
console.log(animals[i])
}
console.log(animals[0] +' is very loyal pet');*/
//---------------------------------End Of Program Q35
//--------------------------------Q36 t-shirt
/*function make_shirt(size,text) {
console.log(`${text} is the name of the player and ${size} is the size of the shirt`);
}
make_shirt(32,'imran');*/
//--------------------------------------End Of Program Q36
//------------------------------------Q37 Large shirt
/*function make_shir(size='large',text='i love javascript') {
console.log(`the size of the shirt is ${size} and the text is ${text}`);
}
make_shir();
function make_shirt(size='medium',title='i like coding'){
console.log(`the size is ${size} and the title is ${title}`)
};
make_shirt();*/
//------------------------------------------End Of Program Q37
//----------------------------------Q38 cities
/*function describe_city(name,country){
console.log( `${name} is in ${country}`);
};
describe_city('karachi','pakistan');
describe_city('lahore','pakistan');
describe_city('istanbol','turkey');*/
//------------------------------------End Of Program Q38
//-------------------------------------Q39 City Names
/*function city_country(city,country){
console.log(`"${city},${country}"`)
};
city_country('lahore','pakistan');
city_country('islamabad','pakistan');
city_country('karachi','pakistan');*/
//--------------------------*Q40 Album not well understand but try my best
/*function make_album(artist_name,album_title,...make_trake){
console.log(artist_name,album_title,...make_trake)
}*/
//-------------------------- End q40
/*
make_album({artist_name:'ali'},{album_title:'learning javascript'},{make_trake:'react',mentro:'sir danish'});
make_album({artist_name:'mohsin'},{album_title:'learning typescript'},{make_trake:'next',mentro:'sir zia'});
make_album({artist_name:'ali'},{album_title:'learning node js'},{make_trake:'mongo',mentro:'sir ali'}); */
//----------------------------------Q41 Magicians
/*let magicians=['john','eric','elon','mark'];
function show_magicians(){
magicians.map((magicians_name)=>{
console.log(magicians_name)
})
}
show_magicians();*/
//-----------------------------------End Of Program Q41
//---------------------------------Q42 Great Magicians
/*let magicians=['john','eric','elon','mark'];
function make_great(great_magicians){
magicians.map((magicians_name)=>{
console.log(magicians_name)
})
let update=magicians.push(great_magicians);
console.log(update)
}
console.log(magicians)
make_great('wick');*/
//--------------------------------End Of Program Q42
//--------------------------Q43 Unchanges Magician
/*let magicians=['john','eric','elon','mark'];
function make_great(great_magicians){
magicians.map((magicians_name)=>{
console.log(magicians_name)
})
let update=magicians.push(great_magicians);
console.log(update)
}
console.log(magicians)*/
//----------------------------Q44 Sandwiches
/*function sandwiches (...list){
console.log(...list);
}
sandwiches('chicken sandwich','egg sandwich','grilled chessa');
sandwiches(2,'chiken sandwich','ham sandwich');
sandwiches('egg','chiken','chesse');*/
//----------------------------end program 44
//............................. start program 45
/* const cars=(manufacture_name,manufacture_model,...other_values)=>{
console.log(`The Manufactture name is ${manufacture_name} the model is ${manufacture_model} and the other features is`,...other_values)
}
cars('honda','civic 2022',{color:'blue',price:150000000});*/
//----------------------------- end program 45