-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
2362 lines (2317 loc) · 113 KB
/
Copy pathindex.html
File metadata and controls
2362 lines (2317 loc) · 113 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JavaScript by Konrad Szymanski</title>
<!-- styles & my scripts -->
<link rel="stylesheet" type="text/css" href="style.css">
<!-- bootstrap -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<!-- <script src="https://code.jquery.com/jquery-3.4.1.slim.min.js"
integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous">
</script> -->
<script src="https://code.jquery.com/jquery-3.5.1.js"
integrity="sha256-QWo7LDvxbWT2tbbQ97B53yJnYU3WhH/C8ycbRAkjPDc=" crossorigin="anonymous"></script>
<!-- <script src="https://code.jquery.com/jquery-3.5.1.slim.js"
integrity="sha256-DrT5NfxfbHvMHux31Lkhxg42LY6of8TaYyK50jnxRnM=" crossorigin="anonymous"></script> -->
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"
integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous">
</script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"
integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous">
</script>
<!-- font awsome -->
<script src="https://kit.fontawesome.com/f2db2ee35b.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<!-- FAVICON-->
<link rel="icon" type="image/png" sizes="32x32" href="/favicon/favicon-32x32.png">
</head>
<body>
<a id="btnTopOnScroll"></a>
<h3 id="top">JavaScript basic
<small class="text-muted">Exercises, Practice, Solution</small>
</h3>
<a href="https://www.w3resource.com/javascript-exercises/javascript-basic-exercises.php"
class="btn btn-outline-dark active link " role="button" aria-pressed="true" target="_blank">Link:
w3resource.com</a>
<a href="#footer" class="btn btn-outline-dark active link " role="button" aria-pressed="true">Go to the last
task</a>
<p class="text-center">*Numbers & strings should be separate by a space.</p>
<h5 class="text-center">Thank you for visiting my page. All the JavaScript code is here:
<a href='https://github.com/konradszymanski/JavaScript-basic/blob/master/script.js' target="_blank">
<button type="button" class="btn btn-dark btn-sm "> <i class="fab fa-github"> </i> JS
CODE</button></a>
</h5>
<table class=" table .table-responsive table-bordered text-center table-striped">
<thead class="thead-dark">
<tr>
<th scope="col">#</th>
<th scope="col">Task</th>
<th scope="col">Output</th>
</tr>
</thead>
<tbody>
<!-- task -->
<tr>
<th scope="row">1</th>
<td>Write a JavaScript program to display the current day and time in the following format:<br>
Sample Output : Today is : Tuesday.<br>
Current time is : 10 PM : 30 : 38</td>
<td id="task1"></td>
</tr>
<!-- task -->
<tr>
<th scope="row">2</th>
<td>Write a JavaScript program to print the contents of the current window.</td>
<td class="align-middle"><button onclick="window.print()" type="button"
class="btn btn-dark btn-sm">Print this page</button></td>
</tr>
<!-- task -->
<tr>
<th scope="row">3</th>
<td>Write a JavaScript program to get the current date.
Expected Output :</br>
mm-dd-yyyy, mm/dd/yyyy or dd-mm-yyyy, dd/mm/yyyy</td>
<td id="task3"></td>
</tr>
<!--task4-->
<tr>
<th scope="row">4</th>
<td>Write a JavaScript program to find the area of a triangle where lengths of the three of its sides
are 5, 6, 7.</td>
<td id="task4"></td>
</tr>
<!--task5-->
<tr>
<th scope="row">5</th>
<td>Write a JavaScript program to rotate the string 'w3resource' in right direction by periodically
removing one letter from the end of the string and attaching it to the front.</td>
<td id="task5">
<p id="ans5"></p>
</td>
</tr>
<!--task6-->
<tr>
<th scope="row">6</th>
<td>Write a JavaScript program to determine whether a given year is a leap year in the Gregorian
calendar.</td>
<td id="task6">
<div class="input-group">
<input type="text" id="leapYear" pattern="{4}" maxlength="4" class="form-control"
placeholder="YYYY" aria-label="" aria-describedby="basic-addon2">
<button type="button" class="btn btn-dark btn-sm" onclick="checkYear()">Checker</button>
<div class="input-group-append"></div>
</div>
<p class="answer" id="againLeap"></p>
</td>
</tr>
<!--task7-->
<tr>
<th scope="row">7</th>
<td>Write a JavaScript program to find 1st January is being a Sunday between 2014 and 2050.</td>
<td id="task7"></td>
</tr>
<!--task8-->
<tr>
<th scope="row">8</th>
<td>Write a JavaScript program where the program takes a random integer between 1 to 10, the user is
then prompted to input a guess number. If the user input matches with guess number, the program will
display a message "Good Work" otherwise display a message "Not matched".</td>
<td id="task8">
<p>Guess the number from 1-10</p>
<div class="input-group">
<input type="text" id="takeNumber" pattern="" maxlength="1" class="form-control" placeholder="#"
aria-label="" aria-describedby="basic-addon2">
<button type="button" class="btn btn-dark btn-sm" onclick="guessNumber()">Try me!</button>
<div class="input-group-append"></div>
</div>
<p class="answer" id="guessOutcome"></p>
</td>
</tr>
<!--task9-->
<tr>
<th scope="row">9</th>
<td>Write a JavaScript program to calculate days left until next Christmas.</td>
<td id="task9">
<p class="answer" id="one"></p>
<p class="answer" id="two"></p>
</td>
</tr>
<!--task10-->
<tr>
<th scope="row">10</th>
<td>Write a JavaScript program to calculate multiplication and division of two numbers (input from
user). </td>
<td id="task10">
<input type="text" id="firstNumber" class="form-control" placeholder="1st number" aria-label=""
aria-describedby="basic-addon2">
<input type="text" id="secondNumber" class="form-control" placeholder="2nd number" aria-label=""
aria-describedby="basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="multiply()">Multiply</button>
<button type="button" class="btn btn-dark btn-sm" onclick="divide()">Divide</button>
<p class="answer" id="task10outcome"></p>
</td>
</tr>
<!--task11-->
<tr>
<th scope="row">11</th>
<td>Write a JavaScript program to convert temperatures to and from Celsius, Fahrenheit.</td>
<td id="task11">
<input type="text" id="celsius" class="form-control" placeholder="Write Celsius" aria-label=""
aria-describedby="basic-addon2">
<input type="text" id="fahrenheit" class="form-control" placeholder="Write Fahrenheit" aria-label=""
aria-describedby="basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="celsius()">Celsius</button>
<button type="button" class="btn btn-dark btn-sm" onclick="fahrenheit()">Fahrenheit</button>
<p class="answer" id="celfah"></p>
</td>
</tr>
<!--task12-->
<tr>
<th scope="row">12</th>
<td>Write a JavaScript program to get the website URL (loading page)</td>
<td id="task12">
<button type="button" class="btn btn-dark btn-sm" onclick="getUrl()">Get URL</button>
<p class="answer" id="outcomeUrl"></p>
</td>
</tr>
<!--task13-->
<tr>
<th scope="row">13</th>
<td>Write a JavaScript exercise to create a variable using a user-defined name.</td>
<td id="task13"></td>
</tr>
<!--task14-->
<tr>
<th scope="row">14</th>
<td>Write a JavaScript exercise to get the extension of a filename.</td>
<td id="task14">
<button type="button" class="btn btn-dark btn-sm" onclick="getExtension()">Get Extension</button>
<p class="answer" id="extension"></p>
</td>
</tr>
<!--task15-->
<tr>
<th scope="row">15</th>
<td>Write a JavaScript program to get the difference between a given number and 13, if the number is
greater than 13 return double the absolute difference.</td>
<td id="task15">
<div class="input-group">
<input type="text" id="thirteen" pattern="" maxlength="" class="form-control" placeholder="#"
aria-label="" aria-describedby="basic-addon2">
<button type="button" class="btn btn-dark btn-sm" onclick="divideThirteen()">Difference</button>
<div class="input-group-append"></div>
<p id=""></p>
</div>
<p class="answer" id="showthirteen"></p>
</td>
</tr>
<!--task16-->
<tr>
<th scope="row">16</th>
<td>Write a JavaScript program to compute the sum of the two given integers. If the two values are same,
then returns triple their sum.</td>
<td id="task16">
<input type="text" id="sumNumberone" class="form-control" placeholder="1st number" aria-label=""
aria-describedby="basic-addon2">
<input type="text" id="sumNumbertwo" class="form-control" placeholder="2nd number" aria-label=""
aria-describedby="basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="sumNumber()">Sum</button>
<p class="answer" id="sumAnswer"></p>
</td>
</tr>
<!--task17-->
<tr>
<th scope="row">17</th>
<td>Write a JavaScript program to compute the absolute difference between a specified number and 19.
Returns triple their absolute difference if the specified number is greater than 19.</td>
<td id="task16">
<input type="text" id="computeOne" class="form-control" placeholder="1st number" aria-label=""
aria-describedby="basic-addon2">
<input type="text" id="computeTwo" class="form-control" placeholder="2nd number" aria-label=""
aria-describedby="basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="computeNum()">Difference</button>
<p class="answer" id="compute"></p>
</td>
</tr>
<!--task18-->
<tr>
<th scope="row">18</th>
<td>Write a JavaScript program to check two given numbers and return true if one of the number is 50 or
if their sum is 50.</td>
<td id="task">
<input type="text" id="task18a" class="form-control" placeholder="1st number" aria-label=""
aria-describedby="basic-addon2">
<input type="text" id="task18b" class="form-control" placeholder="2nd number" aria-label=""
aria-describedby="basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task18true()">true/false</button>
<p class="answer" id="task18"></p>
</td>
</tr>
<tr>
<th scope="row">19</th>
<td>Write a JavaScript program to check whether a given integer is within 20 of 100 or 400.
</td>
<td id="task">
<div class="input-group">
<input type="text" id="task19a" class="form-control" placeholder="#" aria-label=""
aria-describedby="basic-addon2">
<button type="button" class="btn btn-dark btn-sm" onclick="task19()">check</button>
<div class="input-group-append"></div>
</div>
<p class="answer" id="task19ans"></p>
</div>
</td>
</tr>
<!--task20-->
<tr>
<th scope="row">20</th>
<td>Write a JavaScript program to check from two given integers, whether one is positive and another one
is negative.</td>
<td id="task20">
<input type="text" id="task20a" class="form-control" placeholder="1st number" aria-label=""
aria-describedby="basic-addon2">
<input type="text" id="task20b" class="form-control" placeholder="2nd number" aria-label=""
aria-describedby="basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task20()">true/false</button>
<p class="answer" id="task20ans"></p>
</td>
</tr>
<!--task21-->
<tr>
<th scope="row">21</th>
<td>Write a JavaScript program to create a new string adding "Py" in front of a given string. If the
given string begins
with "Py" then return the original string.</td>
<td id="">
<input type="text" id="task21" class="form-control" placeholder="write something" aria-label=""
aria-describedby="basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task21()">Create</button>
<p class="answer" id="task21ans"></p>
</td>
</tr>
<!--task21-->
<tr>
<th scope="row">22</th>
<td>Write a JavaScript program to remove a character at the specified position of a given string and
return the
new string.</td>
<td id="">
<input type="text" id="task22" class="form-control" placeholder="write something" aria-label=""
aria-describedby="basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task22()">Random remove</button>
<p class="answer" id="task22ans"></p>
<p class="answer" id="task22ansB"></p>
</td>
</tr>
<!--task22-->
<tr>
<th scope="row">23</th>
<td>Write a JavaScript program to create a new string from a given string changing the position of first
and last
characters. The string length must be greater than or equal to 1.</td>
<td id="">
<input type="text" id="task23" class="form-control" placeholder="write something" aria-label=""
aria-describedby="basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task23()">Change letters</button>
<p class="answer" id="task23ans"></p>
</td>
</tr>
<!--task24-->
<tr>
<th scope="row">24</th>
<td>Write a JavaScript program to create a new string from a given string with the first character of
the given string added
at the front and back.</td>
<td id="">
<input type="text" id="task24" class="form-control" placeholder="write something" aria-label=""
aria-describedby="basic-addon2">
</br>
<button type="button2x4" class="btn btn-dark btn-sm" onclick="task24()">Change letters</button>
<p class="answer" id="task24ans"></p>
</td>
</tr>
<!--task25-->
<tr>
<th scope="row">25</th>
<td>Write a JavaScript program to create a new string from a given string taking the last 3 characters
and added at both the
front and back. The string length must be 3 or more.</td>
<td id="task">
<input type="text" id="task25" class="form-control" placeholder="write something" aria-label=""
aria-describedby="basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task25()">Change letters</button>
<p class="answer" id="task25ans"></p>
</td>
</tr>
<!--task26-->
<tr>
<th scope="row">26</th>
<td>Write a JavaScript program to check whether a given positive number is a multiple of 3 or a multiple
of 7.</td>
<td id="task">
<input type="text" id="task26" class="form-control" placeholder="write number" aria-label=""
aria-describedby="basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task26()">Check</button>
<p class="answer" id="task26ans"></p>
</td>
</tr>
<!--task27-->
<tr>
<th scope="row">27</th>
<td>Write a JavaScript program to check whether a string starts with 'Java' and false otherwise.</td>
<td id="task">
<input type="text" id="task27" class="form-control" placeholder="write something" aria-label=""
aria-describedby="basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task27()">Check</button>
<p class="answer" id="task27ans"></p>
</td>
</tr>
<!--task28-->
<tr>
<th scope="row">28</th>
<td>Write a JavaScript program to check whether two given integer values are in the range 50..99
(inclusive). Return true if
either of them are in the said range.</td>
<td id="task">
<input type="text" id="task28a" class="form-control" placeholder="write numbers" aria-label=""
aria-describedby="basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task28()">Check</button>
<p class="answer" id="task28ans"></p>
</td>
</tr>
<!--task29-->
<tr>
<th scope="row">29</th>
<td>Write a JavaScript program to check whether three given integer values are in the range 50..99
(inclusive). Return true
if one or more of them are in the said range.
</td>
<td id="task">
<input type="text" id="task29" class="form-control" placeholder="write numbers" aria-label=""
aria-describedby="basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task29()">Check</button>
<p class="answer" id="task29ans"></p>
</td>
</tr>
<!--task30-->
<tr>
<th scope="row">30</th>
<td>
Write a JavaScript program to check whether a string "Script" presents at 5th (index 4) position in
a given string, if
"Script" presents in the string return the string without "Script" otherwise return the original
one.
</td>
<td id="task">
<input type="text" id="task30" class="form-control" placeholder="write something" aria-label=""
aria-describedby="basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task30()">Check</button>
<p class="answer" id="task30ans"></p>
</td>
</tr>
<!--task31-->
<tr>
<th scope="row">31</th>
<td>
Write a JavaScript program to find the largest of three given integers.
</td>
<td id="task">
<input type="text" id="task31" class="form-control" placeholder="three numbers" aria-label=""
aria-describedby="basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task31()">Check</button>
<p class="answer" id="task31ans"></p>
</td>
</tr>
<!--task32-->
<tr>
<th scope="row">32</th>
<td>
Write a JavaScript program to find a value which is nearest to 100 from two different given integer
values.
</td>
<td id="task"><input type="text" id="task32" class="form-control" placeholder="two numbers"
aria-label="" aria-describedby="basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task32()">Check</button>
<p class="answer" id="task32ans"></p>
</td>
</tr>
<!--task33-->
<tr>
<th scope="row">33</th>
<td>Write a JavaScript program to check whether two numbers are in range 40..60 or in the range 70..100
inclusive.</td>
<td id="task">
<input type="text" id="task33" class="form-control" placeholder="two numbers" aria-label=""
aria-describedby="basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task33()">Check</button>
<p class="answer" id="task33ans"></p>
</td>
</tr>
<!--task34-->
<tr>
<th scope="row">34</th>
<td>Write a JavaScript program to find the larger number from the two given positive integers, the two
numbers are in the
range 40..60 inclusive.</td>
<td id="task">
<input type="text" id="task34" class="form-control" placeholder="two numbers" aria-label=""
aria-describedby="basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task34()">Check</button>
<p class="answer" id="task34ans"></p>
</td>
</tr>
<!--task35-->
<tr>
<th scope="row">35</th>
<td>
Write a program to check whether a specified character exists within the 2nd to 4th position in a
given string.
</td>
<td id="task">
<input type="text" id="task35a" class="form-control" placeholder="write word" aria-label=""
aria-describedby="basic-addon2">
<input type="text" id="task35b" class="form-control" placeholder="write one letter" aria-label=""
aria-describedby="basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task35()">Check</button>
<p class="answer" id="task35ans"></p>
</td>
</tr>
<!--task36-->
<tr>
<th scope="row">36</th>
<td>
Write a JavaScript program to check whether the last digit of the three given positive integers is
same.
</td>
<td id="task">
<input type="text" id="task36" class="form-control" placeholder="three numbers" aria-label=""
aria-describedby="basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task36()">Check</button>
<p class="answer" id="task36ans"></p>
</td>
</tr>
<!--task-->
<tr>
<th scope="row">37</th>
<td>
Write a JavaScript program to create new string with first 3 characters are in lower case from a
given string. If the
string length is less than 3 convert all the characters in upper case.
</td>
<td id="task">
<input type="text" id="task37" class="form-control" placeholder="write something" aria-label=""
aria-describedby="basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task37()">Check</button>
<p class="answer" id="task37ans"></p>
</td>
</tr>
<!--task38-->
<tr>
<th scope="row">38</th>
<td>
Write a JavaScript program to check the total marks of a student in various examinations. The
student will get A+ grade
if the total marks are in the range 89..100 inclusive, if the examination is "Final-exam." the
student will get A+ grade
and total marks must be greater than or equal to 90. Return true if the student get A+ grade or
false otherwise.
</td>
<td id="task">
<button type="button" class="btn btn-dark btn-sm" onclick="task38()">Check</button>
<p class="answer" id="task38ans"></p>
</td>
</tr>
<!--task39-->
<tr>
<th scope="row">39</th>
<td>
Write a JavaScript program to compute the sum of the two given integers, If the sum is in the range
50..80 return 65
other wise return 80.
</td>
<td id="task">
<input type="text" id="task39" class="form-control" placeholder="write two integers" aria-label=""
aria-describedby="basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task39()">Check</button>
<p class="answer" id="task39ans"></p>
</td>
</tr>
<!--task40-->
<tr>
<th scope="row">40</th>
<td>
Write a JavaScript program to check from two given integers whether one of them is 8 or their sum or
difference is 8.
</td>
<td id="task">
<input type="text" id="task40" class="form-control" placeholder="write two integers" aria-label=""
aria-describedby="basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task40()">Check</button>
<p class="answer" id="task40ans"></p>
</td>
</tr>
<!--task-->
<tr>
<th scope="row">41</th>
<td>
Write a JavaScript program to check three given numbers, if the three numbers are same return 30
otherwise return 20 and if two numbers are same return 40.
</td>
<td id="task">
<input type="text" id="task41" class="form-control" placeholder="write three integers" aria-label=""
aria-describedby="basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task41()">Check</button>
<p class="answer" id="task41ans"></p>
</td>
</tr>
<!--task42-->
<tr>
<th scope="row">42</th>
<td>
Write a JavaScript program to check whether three given numbers are increasing in strict mode or in
soft mode. Go to the
editor
Note: Strict mode -> 10, 15, 31 : Soft mode -> 24, 22, 31 or 22, 22, 31
</td>
<td id="task">
<input type="text" id="task42" class="form-control" placeholder="write three integers" aria-label=""
aria-describedby="basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task42()">Check</button>
<p class="answer" id="task42ans"></p>
</td>
</tr>
<!--task43-->
<tr>
<th scope="row">43</th>
<td>
Write a JavaScript program to check from three given numbers (non negative integers) that two or all
of them have the
same rightmost digit.
</td>
<td id="task">
<input type="text" id="task43" class="form-control" placeholder="write three integers" aria-label=""
aria-describedby="basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task43()">Check</button>
<p class="answer" id="task43ans"></p>
</td>
</tr>
<!--task44-->
<tr>
<th scope="row">44</th>
<td>
Write a JavaScript program to check from three given integers that whether a number is greater than
or equal to 20 and
less than one of the others.
</td>
<td id="task">
<input type="text" id="task44" class="form-control" placeholder="write three integers" aria-label=""
aria-describedby="basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task44()">Check</button>
<p class="answer" id="task44ans"></p>
</td>
</tr>
<!--task45-->
<tr>
<th scope="row">45</th>
<td>
Write a JavaScript program to check two given integer values and return true if one of the number is
15 or if their sum
or difference is 15.
</td>
<td id="task">
<input type="text" id="task45" class="form-control" placeholder="write two integers" aria-label=""
aria-describedby="basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task45()">Check</button>
<p class="answer" id="task45ans"></p>
</td>
</tr>
<!--task-->
<tr>
<th scope="row">46</th>
<td>
Write a JavaScript program to check two given non-negative integers that whether one of the number
(not both) is multiple of 7 or 11.
</td>
<td id="task">
<input type="text" id="task46" class="form-control" placeholder="write two integers" aria-label=""
aria-describedby="basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task46()">Check</button>
<p class="answer" id="task46ans"></p>
</td>
</tr>
<!--task47-->
<tr>
<th scope="row">47</th>
<td>
Write a JavaScript program to check whether a given number is presents in the range 40..10000. For
example 40 presents in 40 and 4000
</td>
<td id="task">
<input type="text" id="task47" class="form-control" placeholder="write number" aria-label=""
aria-describedby="basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task47()">Check</button>
<p class="answer" id="task47ans"></p>
</td>
</tr>
<!--task48-->
<tr>
<th scope="row">48</th>
<td>
Write a JavaScript program to reverse a given string.
</td>
<td id="task">
<input type="text" id="task48" class="form-control" placeholder="write something" aria-label=""
aria-describedby=" basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task48()">Check</button>
<p class="answer" id="task48ans"></p>
</td>
</tr>
<!--task49-->
<tr>
<th scope="row">49</th>
<td>
Write a JavaScript program to replace every character in a given string with the character following
it in the alphabet.
</td>
<td id="task">
<input type="text" id="task49" class="form-control" placeholder="write something" aria-label=""
aria-describedby=" basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task49()">Check</button>
<p class="answer" id="task49ans"></p>
</td>
</tr>
<!--task50-->
<tr>
<th scope="row">50</th>
<td>
Write a JavaScript program to capitalize the first letter of each word of a given string.
</td>
<td id="task">
<input type="text" id="task50" class="form-control" placeholder="write something" aria-label=""
aria-describedby=" basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task50()">Check</button>
<p class="answer" id="task50ans"></p>
</td>
</tr>
<!--task51-->
<tr>
<th scope="row">51</th>
<td>
Write a JavaScript program to convert a given number to hours and minutes.
</td>
<td id="task">
<input type="text" id="task51" class="form-control" placeholder="write number" aria-label=""
aria-describedby=" basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task51()">Check</button>
<p class="answer" id="task51ans"></p>
</td>
</tr>
<!--task52-->
<tr>
<th scope="row">52</th>
<td>
Write a JavaScript program to convert the letters of a given string in alphabetical order.
</td>
<td id="task">
<input type="text" id="task52" class="form-control" placeholder="write something" aria-label=""
aria-describedby=" basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task52()">Check</button>
<p class="answer" id="task52ans"></p>
</td>
</tr>
<!--task-->
<tr>
<th scope="row">53</th>
<td>
Write a JavaScript program to check whether the characters a and b are separated by exactly 3 places
anywhere (at least
once) in a given string.
</td>
<td id="task">
<input type="text" id="task53" class="form-control" placeholder="write something" aria-label=""
aria-describedby=" basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task53()">Check</button>
<p class="answer" id="task53ans"></p>
</td>
</tr>
<!--task54-->
<tr>
<th scope="row">54</th>
<td>
Write a JavaScript program to count the number of vowels in a given string.
</td>
<td id="task">
<input type="text" id="task54" class="form-control" placeholder="write something" aria-label=""
aria-describedby=" basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task54()">Check</button>
<p class="answer" id="task54ans"></p>
</td>
</tr>
<!--task55-->
<tr>
<th scope="row">55</th>
<td>
Write a JavaScript program to check whether a given string contains equal number of p's and t's.
</td>
<td id="task">
<input type="text" id="task55" class="form-control" placeholder="write something" aria-label=""
aria-describedby=" basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task55()">Check</button>
<p class="answer" id="task55ans"></p>
</td>
</tr>
<!--task56-->
<tr>
<th scope="row">56</th>
<td>
Write a JavaScript program to divide two positive numbers and return a string with properly
formatted commas
</td>
<td id="task">
<input type="text" id="task56" class="form-control" placeholder="write number" aria-label=""
aria-describedby=" basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task56()">Check</button>
<p class="answer" id="task56ans"></p>
</td>
</tr>
<!--task-->
<tr>
<th scope="row">57</th>
<td>
Write a JavaScript program to create a new string of specified copies (positive number) of a given
string.
</td>
<td id="task">
<input type="text" id="task57" class="form-control" placeholder="word and number" aria-label=""
aria-describedby=" basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task57()">Check</button>
<p class="answer" id="task57ans"></p>
</td>
</tr>
<!--task-->
<tr>
<th scope="row">58</th>
<td>
Write a JavaScript program to create a new string of 4 copies of the last 3 characters of a given
original string. The
length of the given string must be 3 and above.
</td>
<td id="task">
<input type="text" id="task58" class="form-control" placeholder="word and number" aria-label=""
aria-describedby=" basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task58()">Check</button>
<p class="answer" id="task58ans"></p>
</td>
</tr>
<!--task-->
<tr>
<th scope="row">59</th>
<td>
Write a JavaScript program to extract the first half of a string of even length.
</td>
<td id="task">
<input type="text" id="task59" class="form-control" placeholder="write something" aria-label=""
aria-describedby=" basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task59()">Check</button>
<p class="answer" id="task59ans"></p>
</td>
</tr>
<!--task-->
<tr>
<th scope="row">60</th>
<td>
Write a JavaScript program to create a new string without the first and last character of a given
string.
</td>
<td id="task">
<input type="text" id="task60" class="form-control" placeholder="write something" aria-label=""
aria-describedby=" basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task60()">Check</button>
<p class="answer" id="task60ans"></p>
</td>
</tr>
<!--task-->
<tr>
<th scope="row">61</th>
<td>
Write a JavaScript program to concatenate two strings except their first character.
</td>
<td id="task">
<input type="text" id="task61" class="form-control" placeholder="write something" aria-label=""
aria-describedby=" basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task61()">Check</button>
<p class="answer" id="task61ans"></p>
</td>
</tr>
<!--task-->
<tr>
<th scope="row">62</th>
<td>
Write a JavaScript program to move last three character to the start of a given string. The string
length must be
greater or equal to three.
</td>
<td id="task">
<input type="text" id="task62" class="form-control" placeholder="write something" aria-label=""
aria-describedby=" basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task62()">Check</button>
<p class="answer" id="task62ans"></p>
</td>
</tr>
<!--task-->
<tr>
<th scope="row">63</th>
<td>
Write a JavaScript program to create a string using the middle three characters of a given string of
odd length. The
string length must be greater or equal to three.
</td>
<td id="task">
<input type="text" id="task63" class="form-control" placeholder="write something" aria-label=""
aria-describedby=" basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task63()">Check</button>
<p class="answer" id="task63ans"></p>
</td>
</tr>
<!--task-->
<tr>
<th scope="row">64</th>
<td>
Write a JavaScript program to concatenate two strings and return the result. If the length of the
strings are not same
then remove the characters from the longer string.
</td>
<td id="task">
<input type="text" id="task64" class="form-control" placeholder="write two words" aria-label=""
aria-describedby=" basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task64()">Check</button>
<p class="answer" id="task64ans"></p>
</td>
</tr>
<!--task-->
<tr>
<th scope="row">65</th>
<td>
Write a JavaScript program to test whether a string end with "Script". The string length must be
greater or equal to 6.
</td>
<td id="task">
<input type="text" id="task65" class="form-control" placeholder="write something" aria-label=""
aria-describedby=" basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task65()">Check</button>
<p class="answer" id="task65ans"></p>
</td>
</tr>
<!--task-->
<tr>
<th scope="row">66</th>
<td>
Write a JavaScript program to display the city name if the string begins with "Los" or "New"
otherwise return blank
</td>
<td id="task">
<input type="text" id="task66" class="form-control" placeholder="write something" aria-label=""
aria-describedby=" basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task66()">Check</button>
<p class="answer" id="task66ans"></p>
</td>
</tr>
<!--task-->
<tr>
<th scope="row">67</th>
<td>
Write a JavaScript program to create a new string from a given string, removing the first and last
characters of the
string if the first or last character are 'P'. Return the original string if the condition is not
satisfied.
</td>
<td id="task">
<input type="text" id="task67" class="form-control" placeholder="write something" aria-label=""
aria-describedby=" basic-addon2">
</br>
<button type="button" class="btn btn-dark btn-sm" onclick="task67()">Check</button>
<p class="answer" id="task67ans"></p>
</td>
</tr>
<!--task-->
<tr>
<th scope="row">68</th>
<td>
Write a JavaScript program to create a new string using the first and last n characters from a given
sting. The string
length must be greater or equal to n.
</td>