-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.js
More file actions
1497 lines (1309 loc) · 43.1 KB
/
Copy pathapp.js
File metadata and controls
1497 lines (1309 loc) · 43.1 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
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
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//|.....................CHAPTER 1........................|
// (ALERTS) #1
/*let guest=("Sir Wellcome to JAVASCRIPT !!");
alert(guest);*/
// (ALERTS) #2
/*let error=("Error !! Please Enter A valid Password");
alert(error);*/
// (ALERTS) #3
/*let jsLand=("Wellcome To JS Land... \nHappy Coding.!");
alert(jsLand);*/
// (ALERTS) #4
/*let jsLand=("Wellcome To JS Land..");
alert(jsLand);
let hapyCoding=("Happy Coding! \nPrevent this page from creating additional dialogues");
alert(hapyCoding);*/
// (ALERTS) #5
/*let hello=("Hello I CAn Run JS Through My Web Browser's Console");
console.log(hello);*/
// (ALERTS) #6
// let myName=("Fahad Khan");
// alert(myName);
// (ALERTS) #7
// Body (inside your page’s HTML)
/*..................CHAPTER 2................*/
/*(VARIABLE FOR STRINGS) #01 */
// var username;
/*(VARIABLE FOR STRINGS) #02 */
// var myName=("Fahad khan");
// alert(myName);
/*(VARIABLE FOR STRINGS) #03 */
// var message = ("Hello World");
// alert(message);
/*(VARIABLE FOR STRINGS) #04 */
// var myName=("Fahad Khan");
// var age=parseInt(21);
// var data=("CERTIFIED WEBSITE DEVELOPER");
// alert(myName);
// alert(age);
// alert(data);
/*(VARIABLE FOR STRINGS) #05 */
// var pizza=("PIZZA \nPIZZ\nPIZ\nPI\nP");
// alert(pizza);
/*(VARIABLE FOR STRINGS) #06 */
// var myEmail=("My Email Address is ");
// var email=("fahad234@gmail.com");
// var cont=myEmail.concat(email);
// alert(cont);
/*(VARIABLE FOR STRINGS) #07 */
// var firstPara=("I am trying to learn from the book ") ;
// var book=("A smarter way to learn javascript");
// var cont=firstPara.concat(book);
// alert(cont);
/*(VARIABLE FOR STRINGS) #08 */
// var text=("YEah! I can Write HTML content through javascript");
// document.write(text);
/*(VARIABLE FOR STRINGS) #09 */
// var design=("▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬▬");
// alert(design);
/*..................CHAPTER 3................*/
/* (VARIABLES FOR NUMBERS) #01*/
// var age=("i am " + 21 + " years old");
// alert(age);
/* (VARIABLES FOR NUMBERS) #02*/
// var visit=("you have visited this site ");
// var times=("15 Times");
// var cont=visit.concat(times);
// alert(cont);
/* (VARIABLES FOR NUMBERS) #03*/
// var text=("My birth year is ")
// var birthYear=(1990 + "<br>")
// var cont=text.concat(birthYear);
// document.write(cont);
// var dataType=("Data type of my declared variable is number");
// document.write(dataType);
/* (VARIABLES FOR NUMBERS) #04*/
// var VisitorName=("Fahad khan "+"Ordered ");
// var quantity=(5);
// var ProducTitle=(5 + " T'shirt(s) ");
// var text=("on XYZ Clothing Store.");
// document.write(VisitorName,ProducTitle,text);
/*..................CHAPTER 4................*/
/*(VARIABLE NAMES: LEGAL & ILLEGAL ) #01 */
// var variable_1=10;
// var variable_2=27;
// var variable_3=11;
// var cont=("my lucky number is " +variable_1+" and my birth date was "+variable_2+" and month was "+variable_3);
// alert(cont);
/*(VARIABLE NAMES: LEGAL & ILLEGAL ) #02 */
// LEGAL VARIABLES
//1.Fahadkhan
//2.FahadKhan
//3.fahadKhan
//4.$fahadkhan
//5._fahadkhan
// ILL-LEGAL VARIABLES
//1. 1Fahad
//2. -FahadKhan
//3. .fahadKhan
//4. $fahadkhan
//5. fahad khan
/*(VARIABLE NAMES: LEGAL & ILLEGAL ) #03 */
// var heading=("Rules for naming JS variables" + "<br />"+ "<br />"+ "<br />"+ "<br />");
// document.write(heading);
// var textPara1=("Variable names can only contain,"+ "$myname," + "_myVariable," + "For example $my_1stVariable" + "<br />");
// document.write(textPara1);
// var textPara2=("Variables must begin with a" + "Letter" + "$" +"or" + "$name, " + "_name or name " + "For example $name, _name or name"+ "<br />");
// document.write(textPara2);
// var textPara3=("Variable names are case " + "Sensitive" + "<br />");
// document.write(textPara3);
// var textPara4=("Variable names should not be JS " +" Keywords");
// document.write(textPara4);
/*..................CHAPTER 5................*/
/*(MATH EXPRESSION) #01*/
// let x=10;
// let y=20;
// let z=("Sum of "+x+ " and " +y+ " is "+ (x+y));
// document.write(z);
/*(MATH EXPRESSION) #02*/
// let x=100;
// let y=10;
// let z=("subtraction of "+x+ " and " +y+ " is "+ (x-y));
// document.write(z);
// let z=("Multiplication of "+x+ " and " +y+ " is "+ (x*y));
// document.write(z);
// let z=("division of "+x+ " and " +y+ " is "+ (x/y));
// document.write(z);
// let z=("modulus of "+x+ " and " +y+ " is "+ (x%y));
// document.write(z);
/*(MATH EXPRESSION) #03*/
// var variable;
// document.write("Value after variable declaration is: " +variable +"<br />");
// variable=5;
// document.write("Initial value: " +variable +"<br />");
// variable=(5+1);
// document.write("Value after increment is: " + variable +"<br />");
// variable+=7;
// document.write("Value After Addition is: " +variable +"<br />");
// variable-=(1);
// document.write("Value after decrement is: " + variable +"<br />");
// variable%=(3);
// document.write("the reminder is:" + variable +"<br />");
/*(MATH EXPRESSION) #04*/
// let ticketPrice=(600);
// let movies=5;
// let calculate=(movies*ticketPrice);
// let myPara=("Total cost to buy "+ movies +" tickets to a movie is " + calculate +"PKR");
// document.write(myPara);
/*(MATH EXPRESSION) #05*/
// document.write("TABLE OF 4" +"<br />" +"<br />");
// var num=4
// for(var i=1;i<=10;i++){
// document.write(num +" X "+i+" = "+num*i +"<br />");
// }
/*(MATH EXPRESSION) #06*/
// let C=25;
// F= C * 9/5 + 32;
// let conversion2= C + ' \xB0C is ' + F + '\xB0F ' +"<br />" +"<br />";
// document.write(conversion2);
// F=70;
// C= F -32 * 5/9;
// let conversion= F + '\xB0F is ' + C + ' \xB0C.' +"<br />";
// document.write(conversion);
/*(MATH EXPRESSION) #07*/
// let Price_1=650;
// document.write("PRICE OF ITEM 1: " +Price_1 +"<br />");
// let quantity_1=3;
// document.write("QUANTITY OF ITEM 1: " +quantity_1 +"<br />");
// let Price_2=100;
// document.write("PRICE OF ITEM 2: " +Price_2 +"<br />");
// let quantity_2=7;
// document.write("QUANTITY OF ITEM 2: " +quantity_2 +"<br />"+"<br />");
// shipCharges=100;
// let calculate=(Price_1*quantity_1) + (Price_2*quantity_2) +shipCharges;
// document.write("Total cost Of Your Order: " + calculate);
/*(MATH EXPRESSION) #08*/
// let totalMarks=1100;
// document.write("Total Marks: " + totalMarks + "<br />");
// let obtainedMarks=850;
// document.write("Obtained marks: " +obtainedMarks + "<br />")
// let average=obtainedMarks/totalMarks *100;
// document.write("Percentage : " + average +"%")
/*(MATH EXPRESSION) #09*/
// let usDollars=10;
// document.write("we have $"+usDollars+" US Dollars" + "<br />");
// let riyals=25;
// document.write("And we have "+riyals+" Saudi riyals" + "<br />");
// calculate=(usDollars*104.80)+(riyals*28);
// document.write("Total Currency In pakistani Rupees :"+calculate)
/*(MATH EXPRESSION) #10*/
// let num=10;
// document.write("My number: "+num + "<br />");
// num+=5;
// document.write("After add 5: "+num + "<br />");
// num/=2;
// document.write("After divide by '2': "+num + "<br />");
/*(MATH EXPRESSION) #11*/
// let currentYear=2021;
// document.write("Current Year : " +currentYear + "<br />");
// let birthYear=1999;
// document.write("Birth Year : " +birthYear + "<br />");
// let calculate=currentYear-birthYear;
// document.write("Your Age is : " + calculate);
/*(MATH EXPRESSION) #12*/
// let radius=20;
// document.write("Radius Of A circle: "+radius + "<br />");
// let circumference=2*(3.142)*radius;
// document.write("The Circumference is :" + circumference + "<br />");
// let area=(3.142)*(20*20);
// document.write(area);
/*(MATH EXPRESSION) #13*/
// let snack=('lays');
// document.write("Favourite Snack :"+snack + "<br />");
// let age=22;
// document.write("Current Age :"+age + "<br />");
// let maxAge=60;
// document.write("Estimated Maximum age :"+maxAge + "<br />");
// let amount=3;
// document.write("Amount Of Snack Per Day :"+amount + "<br />");
// let calculate=(maxAge-age)*amount;
// document.write("You will need "+calculate+ " lays to last you until the ripe old age of "+maxAge);
/*..................CHAPTER 6 to 9................*/
/*(MATH EXPRESSION) #01*/
// let a=10;
// document.write("RESULT:" + "<br />")
// document.write("The value of a is : " +a + "<br />"+ "<br />");
// document.write("........................................."+ "<br />"+ "<br />");
// document.write("The value of ++a is : " + ++a + "<br />");
// document.write("Now the value of a is: " + a + "<br />"+ "<br />");
// document.write("The value of a++ is : " + a++ + "<br />");
// document.write("Now the value of a is: " + a + "<br />"+ "<br />");
// document.write("The value of --a is : " + --a + "<br />");
// document.write("Now the value of a is: " + a + "<br />"+ "<br />");
// document.write("The value of a-- is : " + a-- + "<br />");
// document.write("Now the value of a is: " + a + "<br />"+ "<br />");
/*(MATH EXPRESSION) #02*/
// let a = 2;
// let b = 1;
// --a;
// --a - --b;
// --a - --b + ++b;
// --a - --b + ++b + b--;
// document.write("a is : "+a + "<br />");
// document.write("b is : "+b + "<br />");
// var result = --a - --b + ++b + b--;
// document.write("Result is : "+result + "<br />");
/*(MATH EXPRESSION) #03*/
// let fullName=prompt('Enter your Full Name');
// alert("Wellcome "+fullName+" You Are Ready To Start Your Work")
/*(MATH EXPRESSION) #04*/
// let num = prompt('Please enter your number');
// if (num == '0') {
// num = 5;
// for (var i = 1; i <= 10; i++) {
// document.write(num + " X " + i + " = " + num * i + "<br />");
// }
// }
// else {
// for (var i = 1; i <= 10; i++) {
// document.write(num + " X " + i + " = " + num * i + "<br />");
// }
// }
/*(MATH EXPRESSION) #05*/
// let subject_1=('English');
// let subject_2=('Maths')
// let subject_3=('Urdu');
// totalMarks=100;
// obtMarksSub1=+prompt('Enter you marks of Subject 1 : ');
// sub1marks=obtMarksSub1;
// obtMarksSub2=+prompt('Enter you marks of Subject 2 : ');
// sub2marks=obtMarksSub2;
// obtMarksSub3=+prompt('Enter you marks of Subject 3 : ');
// sub3marks=obtMarksSub3;
// let total_marks=(totalMarks*3);
// let totalObtainMarks=sub1marks+sub2marks+sub3marks;
// let total_percentage=totalObtainMarks/(sub1marks+sub2marks+sub3marks)*100;
// let obj={
// Subject :["Subject ","TM ","OM " ,"Perce "+"<br />"],
// English :[subject_1 ,100,sub1marks,sub1marks+"%"+"<br />"],
// Urdu :[subject_2 ,100,sub2marks,sub2marks+"%"+"<br />"],
// Maths :[subject_3 ,100,sub3marks,sub3marks+"%"]
// }
// document.write(obj.Subject);
// document.write(obj.English);
// document.write(obj.Urdu);
// document.write(obj.Maths +"<br />");
// document.write(total_marks+" ");
// document.write(totalObtainMarks +" ");
// document.write(total_percentage +" ");
// document.write();
/*..................CHAPTER 9 to 11................*/
/*(USER INPUT & CONDITIONAL STATEMENT ) #01*/
// let city=prompt('Please enter Your city');
// if(city==='karachi'){
// alert("Wellcome To City Of Lights");
// }
/*(USER INPUT & CONDITIONAL STATEMENT ) #02*/
// let gender=prompt('Please Enter Your Gender');
// if(gender==='male'){
// alert("Good Morning Sir.");
// }
// else if(gender==='female'){
// alert("Good Morning Ma’am.");
// }
/*(USER INPUT & CONDITIONAL STATEMENT ) #03*/
// let color=prompt('Please Enter traffic light color');
// if(color==='red'){
// alert("Must Stop");
// }
// else if(color==='yellow'){
// alert("Ready To Move");
// }
// else if(color==='green'){
// alert("Move Now");
// }
/*(USER INPUT & CONDITIONAL STATEMENT ) #04*/
// let Fuel =+prompt('please check your fuel');
// if(Fuel<='0.25'){
// alert("Please refill the fuel in your car");
// }
// else{
// alert("Dont Worry Drive Save.!");
// }
/*(USER INPUT & CONDITIONAL STATEMENT ) #05*/
//a (works)
// var a = 4;
// if (++a === 5){
// alert("given condition for variable a is true");
// }
//b (not-worked)
// var b = 82;
// if (b++ === 83){
// alert("given condition for variable b is true");
// }
//c (worked)
// var c = 12;
// if (c++ === 13){
// alert("condition 1 is true");
// }
// if (c === 13){
// alert("condition 2 is true");
// }
// if (++c < 14){
// alert("condition 3 is true");
// }
// if(c === 14){
// alert("condition 4 is true");
// }
//d (Worked)
// var materialCost = 20000;
// var laborCost = 2000;
// var totalCost = materialCost + laborCost;
// if (totalCost === laborCost + materialCost){
// alert("The cost equals");
// }
//e (Worked)
// if (true){
// alert("True");
// }
// if (false){
// alert("False");
// }
//f(Worked)
// if("car" < "cat"){
// alert("car is smaller than cat");
// }
/*(USER INPUT & CONDITIONAL STATEMENT ) #06*/
// let marksObtained=prompt('Enter Your Obtained Marks');
// let totalMarks=300;
// let percentage=(marksObtained/totalMarks*100);
// if(percentage>=80 && percentage <=100){
// document.write('Total MArks : '+totalMarks+"<br />");
// document.write('Marks Obtained :'+marksObtained+"<br />");
// document.write('Percentage : '+percentage+"<br />");
// document.write('Grade : A-one'+"<br />")
// document.write('Remarks : Excellent')
// }
// else if(percentage>=70 && percentage < 80){
// document.write('Total MArks : '+totalMarks+"<br />");
// document.write('Marks Obtained :'+marksObtained+"<br />");
// document.write('Percentage : '+percentage+"<br />");
// document.write('Grade : A'+"<br />")
// document.write('Remarks : Good')
// }
// else if(percentage>=60 && percentage < 70){
// document.write('Total MArks : '+totalMarks+"<br />");
// document.write('Marks Obtained :'+marksObtained+"<br />");
// document.write('Percentage : '+percentage+"<br />");
// document.write('Grade : B'+"<br />")
// document.write('Remarks : You Need To improve')
// }
// else if(percentage>=50 && percentage < 60){
// document.write('Total MArks : '+totalMarks+"<br />");
// document.write('Marks Obtained :'+marksObtained+"<br />");
// document.write('Percentage : '+percentage+"<br />");
// document.write('Grade : Fail'+"<br />")
// document.write('Remarks : Sorry!!')
// }
// else{
// alert("Invalid Numbers");
// }
/*(USER INPUT & CONDITIONAL STATEMENT ) #07*/
// let num=8;
// num=+prompt("Guess The Secret number");
// if(num==8){
// alert('Congratulations!! You Guess the Correct Number');
// }
// else if(num == +1 || num ==-1){
// alert('Close Enough to the Correct Answer.!');
// }
// else{
// alert("Wrong Guess! Try Again.");
// }
/*(USER INPUT & CONDITIONAL STATEMENT ) #08*/
// let num=prompt('please input your number');
// if(num % 3 === 0){
// alert(num+" is divisible by 3");
// }
// else{
// alert(num+" is not divisible by 3")
// }
/*(USER INPUT & CONDITIONAL STATEMENT ) #09*/
// let number = prompt("Enter a number: ");
// if(number % 2 == 0) {
// alert(number+" number is even.");
// }
// else {
// alert(number+" number is odd.");
// }
/*(USER INPUT & CONDITIONAL STATEMENT ) #10*/
// let temp=prompt("Enter Temperature");
// if(temp>40 && temp <=50){
// alert('It is too hot outside');
// }
// else if(temp>30 && temp <=40){
// alert('Th eweather today is normal');
// }
// else if(temp>20 && temp <=30){
// alert('todays weather is cool');
// }
// else if(temp>10 && temp <=20){
// alert('OMG! todays weather is so cool');
// }
// else{
// alert("Please enter temperature between the range of 10 to 50");
// }
/*(USER INPUT & CONDITIONAL STATEMENT ) #11*/
// let num_1=parseInt(prompt('Enter number 1 :'));
// let num_2=parseInt(prompt('Enter number 2 :'));
// let operation=prompt('Please Choose your operation');
// let result;
// if(operation=='+'){
// result=(num_1+num_2);
// alert(result);
// }
// else if(operation== '-'){
// result=(num_1-num_2);
// alert(result);
// }
// else if(operation== '*'){
// result=(num_1*num_2);
// alert(result);
// }
// else if(operation== '/'){
// result=(num_1/num_2);
// alert(result);
// }
// else if(operation== '%'){
// result=(num_1%num_2);
// alert(result);
// }
// else{
// alert("Please choose coorect operator!!");
// }
/*..................CHAPTER 12 to 13................*/
/*(IF…ELSE & ELSE IF STATEMENT,TESTING SET OF CONDITIONS ) #01*/
// let char=prompt('Enter your character :');
// let result;
// if(char >='a' && char <='z'){
// result=("this is alphabetic lower case character");
// alert(result);
// }
// else if(char >='A' && char <='Z'){
// result=("this is alphabetic Upper case character");
// alert(result);
// }
// else{
// alert("given character is a number!!");
// }
/*(IF…ELSE & ELSE IF STATEMENT,TESTING SET OF CONDITIONS ) #02*/
// let num_1=parseInt(prompt('enter number 1 : '));
// let num_2=parseInt(prompt('enter number 2 : '));
// if(num_1 > num_2){
// alert('The larger between theese two is '+ num_1)
// }
// else if(num_2 > num_1){
// alert('The larger between theese two is '+ num_2)
// }
// else{
// alert("Both are Same!!");s
// }
/*(IF…ELSE & ELSE IF STATEMENT,TESTING SET OF CONDITIONS ) #03*/
// let number = parseInt(prompt("Enter a number: "));
// if (number > 0) {
// alert("The number is positive");
// }
// else if (number == 0) {
// alert("The number is zero");
// }
// else {
// alert("The number is negative");
// }
/*(IF…ELSE & ELSE IF STATEMENT,TESTING SET OF CONDITIONS ) #04*/
// let char=prompt('Enter your character');
// if(char==='a' || char==='e' || char==='i' || char==='o' || char==='u'){
// alert(true);
// }
// else{
// alert(false);
// }
/*(IF…ELSE & ELSE IF STATEMENT,TESTING SET OF CONDITIONS ) #05*/
// let password_1=("fahadkhan");
// var password_2 = prompt("What is your name", "");
// if(password_2==password_1){
// alert('Correct! The password you entered matches the original password');
// }
// else if (password_2 == "") {
// alert("please enter your password");
// }
// else if(password_2!==password_1){
// alert("Incorrect Password");
// }
/*(IF…ELSE & ELSE IF STATEMENT,TESTING SET OF CONDITIONS ) #06*/
// var greeting;
// var hour = 13;
// if (hour < 18) {
// alert(greeting = "Good day");
// }
// else{
// alert(greeting = "Good evening");
// }
/*(IF…ELSE & ELSE IF STATEMENT,TESTING SET OF CONDITIONS ) #07*/
// let time=1900;
// time=parseInt(prompt('Enter your time'));
// if(time >= 0000 && time < 1200){
// alert('Good Morning');
// }
// else if(time >= 1200 && time < 1700){
// alert('Good Afternoon');
// }
// else if(time >= 1700 && time < 2100){
// alert('Good Afternoon');
// }
// else if(time >= 2100 && time < 2359){
// alert('Good Night');
// }
// else{
// alert('Please Enter Apporopriate Time');
// }
/*..................CHAPTER 14 to 16................*/
/* (Array) #01 */
// let arr=["","","",""];
/* (Array) #02 */
// let arr={};
/* (Array) #03 */
// let arr=["fahad","saad","ahad","ebad"];
// alert(arr);
/* (Array) #04 */
// let arr=[5,10,15,20];
// alert(arr);
/* (Array) #05 */
// let arr=[true,false,true,false];
// alert(arr);
/* (Array) #06 */
// let arr=[10,"Fahad",15,true];
// alert(arr);
/* (Array) #07 */
// document.write("Qualification:" +"<br />"+"<br />");
// let arr=["1)SSC"+"<br />"+"2)HSC"+"<br />"+"3)BCS"+"<br />"+"4)BS"+"<br />"+"5)MCOM"+"<br />"+"6)MS"+"<br />"+"7)M,PHIL"+"<br />"+"8)PHD"]
// document.write(arr);
/* (Array) #08 */
// let arr_1=["Fahad","Saad","Ahad"];
// let arr_2=[320,400,350];
// let percentageofFahad=arr_2[0]/500*100;
// let percentageofSaad=arr_2[1]/500*100;
// let percentageofAhad=arr_2[2]/500*100;
// document.write("Score of "+arr_1[0]+" is "+arr_2[0]+". percentage :"+percentageofFahad+"%"+"<br />");
// document.write("Score of "+arr_1[1]+" is "+arr_2[1]+". percentage :"+percentageofSaad+"%"+"<br />");
// document.write("Score of "+arr_1[2]+" is "+arr_2[2]+". percentage :"+percentageofAhad+"%");
/* (Array) #09 */
// let arr=["red","green","blue","black"];
// document.write(arr);
// document.write("<br />")
// arr.unshift(prompt("what color do you want to add at the beginning"));
// document.write(arr);
// document.write("<br />")
// arr.push(prompt("what color do you want to add at the end"));
// document.write(arr);
// document.write("<br />")
// arr.unshift(prompt("what colors do you want to add at the beginning"));
// document.write(arr);
// document.write("<br />")
// arr.shift(prompt("what colors do you want to delete at the end"));
// document.write(arr);
// document.write("<br />")
// arr.splice(prompt("where do you want to add color at array"));
// arr.splice(prompt("what color do you want to add at the array"));
// document.write(arr);
/* (Array) #10 */
// document.write("Scores of Students : ")
// let arr=[320,230,480,120];
// document.write(arr);
// arr.sort();
// document.write("<br />")
// document.write("Ordered Scores of Students : ")
// document.write(arr);
/* (Array) #11 */
// document.write("Cities :"+"<br />")
// let cities=["karachi","lahore","multan","quetta","peshawar","hyderabad"+"<br />"+"<br />"]
// document.write(cities);
// document.write("Selected Cities :"+"<br />")
// let selectedCities=cities.splice(2,3);
// document.write(selectedCities);
/* (Array) #12 */
// document.write('Array'+"<br />");
// let arr = ["this", "is", "my","cat"+"<br />"+"<br />"];
// document.write(arr);
// document.write('String:'+"<br />");
// arr = ["this "+"is "+"my"+" cat."];
// document.write(arr);
/* (Array) #13 */
// document.write('Devices'+"<br />");
// let arr=["keybord","Mouse","Printer","Monitor"+"<br />"+"<br />"];
// document.write(arr);
// document.write('Out :'+"<br />");
// document.write(arr[0]+"<br />");
// document.write('Out :'+"<br />");
// document.write(arr[1]+"<br />");
// document.write('Out :'+"<br />");
// document.write(arr[2]+"<br />");
// document.write('Out :'+"<br />");
// document.write(arr[3]);
/* (Array) #14 */
// document.write('Devices'+"<br />");
// let arr=["keybord","Mouse","Printer","Monitor"+"<br />"+"<br />"];
// document.write(arr);
// document.write('Out :'+"<br />");
// document.write(arr[3]);
// document.write('Out :'+"<br />");
// document.write(arr[2]+"<br />");
// document.write('Out :'+"<br />");
// document.write(arr[1]+"<br />");
// document.write('Out :'+"<br />");
// document.write(arr[0]);
/* (Array) #15 */
// let arr=["Apple","Samsung","motorolla","Nokia","Sony & Haier"]
// document.write(arr);
// not display any dropdown/select menu in the pdf document
/*..................CHAPTER 17 to 20................*/
/* (Array and Loops) #01 */
// let arr=[
// [],[]
// ];
/* (Array and Loops) #02 */
// let arr=[
// [0,1,2,3+"<br />"],
// [1,0,1,2+"<br />"],
// [2,1,0,1+"<br />"]
// ]
// document.write(arr);
/* (Array and Loops) #03 */
// let num=10;
// let i;
// for(i=1;i<=10;i++){
// document.write(i+"<br />");
// }
/* (Array and Loops) #04 */
// let i;
// let num=parseInt(prompt('Enter table number:'));
// let tableLength=parseInt(prompt('Enter table Length:'));
// document.write('Multiplication Table of : ' + num +"<br />");
// document.write('Length of Table : ' + tableLength+"<br />"+"<br />");
// for(i=1;i==tableLength;i++){
// document.write(num+' X '+ i +' = '+ i*num +"<br />");
// }
/* (Array and Loops) #05 */
// let fruits=["apple", "banana", "mango", "orange","strawberry"]
// for(let i=0;i<fruits.length;i++){
// document.write(fruits[i]+"<br />")
// }
// document.write("<br />");
// for(i=0;i<fruits.length;i++){
// document.write('Element at index ' +i+' is '+ fruits[i]+" <br />")
// }
/* (Array and Loops) #06 */
// let i;
// let arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
// document.write("Counting"+" <br />")
// for(let i=0;i<arr.length-5;i++){
// document.write(arr[i]+",");
// }
// document.write(" <br />"+" <br />"+" <br />")
// document.write("Reverse Counting"+" <br />")
// for(i=arr.length-11; i>=0; i--){
// document.write(arr[i]+",");
// }
// document.write(" <br />" + " <br />" + " <br />")
// document.write("Even :" + " <br />")
// for (i = 0; i <= arr.length; i++){
// if (arr[i] % 2 == 0) {
// document.write(arr[i] + ",");
// }
// }
// document.write(" <br />" + " <br />" + " <br />")
// document.write("ODD : :" + " <br />")
// for (i = 0; i <= arr.length-1; i++){
// if (arr[i] % 2 !== 0) {
// document.write(arr[i] + ",");
// }
// }
// document.write(" <br />" + " <br />" + " <br />")
// document.write("Series :" + " <br />")
// for (i = 0; i <= arr.length; i++){
// if (arr[i] % 2 == 0) {
// document.write(arr[i] + "k,");
// }
// }
/* (Array and Loops) #07 */
// let i,j;
// let arr = ['cake', 'apple-pie', 'cookie', 'chips', 'patties'];
// let user = prompt("Wellcome to abc Bakery!!What do you want to order sir/ma'am")
// let flag=false;
// for(j=0;j<1;j++){
// for ( i = 0; i <= arr.length; i++) {
// if (arr[i] === user ) {
// document.write(arr[i] + " is Available at index "+ [i] +" in our bakery")
// flag==true;
// }
// }
// }
// if(flag==false){
// document.write("We are Sorry sir " +user +" is not available in our bakery")
// }
/* (Array and Loops) #08 */
// let array1 = [24, 53, 78,92,12];
// let sortedArray=array1.sort();
// document.write(sortedArray+"<br />");
// document.write("Largest Number :"+sortedArray[4]);
/* (Array and Loops) #09 */
// let array1 = [24, 53, 78,92,12];
// let sortedArray=array1.sort();
// document.write(sortedArray+"<br />");
// document.write("Smallest Number :"+sortedArray[0]);
/* (Array and Loops) #10 */
// let num=5;
// for(i=1;i<=20;i++){
// document.write(i*5+",")
// }
/* .................CHAPTER 20 to 30......................*/
/*CHANGING CASE #1*/
// let myName=prompt('Enter your name');
// myName=myName.toUpperCase();
// alert(myName);
/*CHANGING CASE #2*/
// let str=prompt('enter your sentence:')
// str = str.toLowerCase().split(' ');
// for (var i = 0; i < str.length; i++) {
// str[i] = str[i].charAt(0).toUpperCase() + str[i].slice(1);
// }
// call=str.join(' ');
// alert(call);
/*Strings: measuring length and extracting parts #1*/
// let mobile = prompt("Enter a Mobile phone model");
// let charsInMobile= mobile.length;
// alert(charsInMobile);
/*Strings: measuring length and extracting parts #2*/
// var str=prompt('enter your string');
// var lastCharOfStr=str.slice(-1);
// alert(lastCharOfStr);
/*Strings: finding segments #1*/
// let country=('pakistani');
// alert(country.indexOf('n'));
/*Strings: finding segments #2*/
// let input=prompt('enter your username');
// for(let i=0;i<input.length;i++){
// if(input[i]=='@' || input[i]=='!' || input[i]==',' || input[i]=='.'){
// alert('enter a valid user name!!');
// break;
// }
// else{
// alert(input);
// break;
// }
// }
/*Strings: finding segments #3*/
// let temp = "The quick brown fox jumps over the lazy dog";
// let cont =(temp.slice(0,3));
// let occurrences=cont.length;
// alert(occurrences);
/*Strings: finding a character at a location #1*/
// let country=('pakistani');
// let index= country.charAt(3);
// alert(index);
/*Strings: replacing characters #1*/
// let word=('hyderabad');
// let replacing=word.replace('hyder','Islam');
// alert(replacing);
/*Strings: replacing characters #2*/
// let word=('Ali and Sami are best friends. They play cricket and football together');
// let replacing=word.replace(/and/g,'&');
// alert(replacing);
/*Rounding numbers #1*/
// let num=parseFloat(prompt('enter your number'));
// final=Math.round(num);
// final=Math.floor(num);
// final=Math.ceil(num);
// alert(final);
/*Rounding numbers #2*/
// let num=parseFloat(prompt('enter your number'));
// final=Math.round(num);
// final=Math.floor(num);
// final=Math.ceil(num);
// alert(final);
/*Generating random numbers #1*/
// let random=Math.random();
// let variable=(random*6)+1;
// let end=Math.floor(variable);
// alert(end);
/*Generating random numbers #2*/
// let random=Math.random();
// let variable=(random*2)+1;
// let end=Math.floor(variable);
// if(end==2){
// alert('Heads');
// }
// else{
// alert('Tales');
// }
/*Generating random numbers #3*/
// let random=Math.random();
// let variable=(random*10)+1;
// let end=Math.floor(variable);
// let num=parseInt(prompt('enter secret number'));
// if(num==end){
// alert('Congratulations You Guess The Correct Number');
// }
// else{
// alert('Try again');
// }
/*Converting strings to integers and decimals #1*/
// let weight=parseInt(prompt('enter your weight'));
// alert(weight);
// alert(weight+'kgs');
// let weight=parseFloat(prompt('enter your weight'));
// alert(weight+'kgs');
// alert(weight+'kilograms')
/*Converting strings to numbers, numbers to strings #1*/
// let num=(472);
// document.write('Before conversion:'+"<br />");
// document.write(`${num}, ${typeof num} `+"<br />"+"<br />");
// document.write('After conversion:'+"<br />");
// num=num.toString();
// document.write(`${num}, ${typeof num} `+"<br />"+"<br />");
/*Converting strings to numbers, numbers to strings #2*/
// let num = 35.36;
// num=num.toString();
// let withoutDot = num.replace(".", "");
// document.write(withoutDot);
/*Controlling the length of decimals #1*/
// let percentage=(30/45*100);
// document.write(percentage.toFixed(2));
// |.......................COMPLETE CHAPTER 20 TO 30.........................|