-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
513 lines (469 loc) · 15 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="./Day1.js"></script>
<script src="./Day2.js"></script>
<script src="./Day3/numberCheck.js"></script>
<script src="./Day3/votingEligibility.js"></script>
<script src="./Day3/nested-if-else.js"></script>
<script src="./Day3/gradeAssignment.js"></script>
<script src="./Day3/dayOfWeek.js"></script>
<script src="./Day3/checkLeapYear.js"></script>
<script src="./Day3/checkEvenOdd.js"></script>
<script src="./Day4/activities.js"></script>
<script src="./Day4/factorialCalculation.js"></script>
<script src="./Day4/multiplicationTable.js"></script>
<script src="./Day4/numberPrinting.js"></script>
<script src="./Day4/patternPrinting.js"></script>
<script src="./Day4/sumCalculation.js"></script>
<script src="./Day5/activities.js"></script>
<script src="./Day6/arrayIteration.js"></script>
<script src="./Day6/arrayManipulation.js"></script>
<script src="./Day6/arrayTranformation.js"></script>
<script src="./Day6/twoDimensionalArray.js"></script>
<script src="./Day7/bookObject.js"></script>
<script src="./Day7/libraryObject.js"></script>
<script src="./Day7/objectIteraion.js"></script>
<script src="./Day8/destructuring.js"></script>
<script src="./Day8/defaultParameters.js"></script>
<script src="./Day8/enhancedObjectLiteral.js"></script>
<script src="./Day8/spreadRest.js"></script>
<script src="./Day8/templateLiteral.js"></script>
<script src="./Day9/textContentManipulation.js"></script>
<script src="./Day9/elementCreation.js"></script>
<script src="./Day9/elementRemoval.js"></script>
<script src="./Day9/eventHandling.js"></script>
<script src="./Day9/attributeModification.js"></script>
<script src="./Day9/attributeModification.js"></script>
<link href="./styles.css" rel="stylesheet" />
<title>Document</title>
</head>
<body>
<h1>30 Days Java Script Challenge</h1>
<h2>at https://www.chaicode.com</h2>
<p>
Right click anywhere on the page, select the menu option - inspect. Then
view the result in console
</p>
<nav>
<a href="#day1">Day 1</a>
<a href="#day2">Day 2</a>
<a href="#day3">Day 3</a>
<a href="#day4">Day 4</a>
<a href="#day5">Day 5</a>
<a href="#day6">Day 6</a>
<a href="#day7">Day 7</a>
<a href="#day8">Day 8</a>
<a href="#day9">Day 9</a>
<a href="#day10">Day 10</a>
<a href="#day11">Day 11</a>
<a href="#day12">Day 12</a>
<a href="#day13">Day 13</a>
<a href="#day14">Day 14</a>
<a href="#day15">Day 15</a>
<a href="#day16">Day 16</a>
<a href="#day17">Day 17</a>
<a href="#day18">Day 18</a>
</nav>
<hr />
<!-- DAY 1 -->
<div>
<button id="day1">Day 1 : Variables and Data Types</button>
<ol>
<li>
<a onclick="task1()" href="#">
Declare a variable using var, assign a number, and log the value to
the console.</a
>
</li>
<li>
<a onclick="task2()" href="#"
>Declare a variable using let, assign it a string, and log the value
to the console.</a
>
</li>
<li>
<a onclick="task3()" href="#"
>Declare a variable using const, assign it a boolean value, and log
the value to the console.</a
>
</li>
<li>
<a onclick="task4()" href="#"
>Create variables of different data types (number, string, boolean,
object, array) and log each variables type using the typeof
operator.</a
>
</li>
<li>
<a onclick="task5()" href="#"
>Declare a variable using let, assign it an initial value, reassign
a new value, and log both values to the console.</a
>
</li>
<li>
<a onclick="task6()" href="#"
>Try reassigning a variable declared with const and obsereve the
error.</a
>
</li>
</ol>
</div>
<!-- DAY 2 -->
<div>
<button id="day2">Day 2 : Operators</button>
<ol>
<li>
<a onclick="arithmeticOperations()" href="#">
Perform basic arithmetic operation (addition, subtraction,
multiplication, division, remainder) on two numbers and log the
result.</a
>
</li>
<li>
<a onclick="assignmentOpeartions()" href="#"
>Perform assignment operation += to add a number to a variable and ,
-= to subtract a number from a variable. Log the result.</a
>
</li>
<li>
<a onclick="comparisonAndLogicalOperations()" href="#"
>Compare two numbers using different comparison operators and
combines the conditions using logical operators, logging the
result.</a
>
</li>
<li>
<a onclick="ternaryOperation()" href="#"
>Use ternary operator to determine if a number is positive or
negative and log the result.</a
>
</li>
</ol>
</div>
<!-- DAY 3 -->
<div>
<button id="day3">Day 3 : Control Structures</button>
<ol>
<li>
<a onclick="numberCheck()" href="#">
Use if-else statements to check if a number is positive, negative or
zero.</a
>
</li>
<li>
<a onclick="votingEligibility()" href="#"
>Use if-else statements to check if a person is eligible to vote
(age >=18).</a
>
</li>
<li>
<a onclick="findLargest()" href="#"
>Use nested if-else statements to find largest of three numbers.</a
>
</li>
<li>
<a onclick="dayOfWeek()" href="#"
>Use switch-case statement to determine day of the week, based on a
number(1-7).</a
>
</li>
<li>
<a onclick="assignGrade()" href="#"
>Use switch-case statement to assign a grade ('A", 'B', 'C', 'D',
'F') based on a score.</a
>
</li>
<li>
<a onclick="checkeEvenOdd()" href="#"
>Use ternary operator to check, if a number is odd or even.</a
>
</li>
<li>
<a onclick="checkeLeapYear()" href="#"
>Using multiple conditions check, if a year is leap year.</a
>
</li>
</ol>
</div>
<!-- DAY 4 -->
<div>
<button id="day4">Day 4 : Loops</button>
<ol>
<li>
<a onclick="activitiesDay4()" href="#"> Activities / Tasks</a>
</li>
<li>
<a onclick="printNumbers()" href="#"
>Print numbers from 1 to 10 using for loop and while loop.</a
>
</li>
<li>
<a onclick="printTable()" href="#"
>Print multiplication table of 5 using for loop.</a
>
</li>
<li>
<a onclick="printPattern()" href="#"
>Print pattern of stars using nested loops.</a
>
</li>
<li>
<a onclick="calculateSum()" href="#"
>Calculate the sum of numbers from 1 to 10 using while loop.</a
>
</li>
<li>
<a onclick="calculateFactorial()" href="#"
>Calculate factorial of a number using a do... while loop</a
>
</li>
</ol>
</div>
<!-- DAY 5 -->
<div>
<button id="day5">Day 5 : Functions</button>
<ol>
<li>
<a onclick="activitiesDay5()" href="#"> Activities / Tasks</a>
</li>
</ol>
</div>
<!-- DAY 6 -->
<div>
<button id="day6">Day 6 : Arrays</button>
<ol>
<li>
<a onclick="arrayManipulation()" href="#"> Array Manipulation</a>
</li>
<li>
<a onclick="arrayTransformation()" href="#"> Array Transformation</a>
</li>
<li>
<a onclick="arrayIteration()" href="#"> Array Iteration</a>
</li>
<li>
<a onclick="twoDimensionalArray()" href="#">
Two Dimensional Array Creation and Manipulation Manipulation</a
>
</li>
</ol>
</div>
<!-- DAY 7 -->
<div>
<button id="day7">Day 7 : Objects</button>
<ol>
<li>
<a onclick="bookObject()" href="#">
Create a book object, add properties and methods to it, log
properties and methods result.</a
>
</li>
<li>
<a onclick="libraryObject()" href="#"
>Define a library object containg an array of book objects and log
the library's details.</a
>
</li>
<li>
<a onclick="objectIteration()" href="#"
>Iterate over an object properties using for ... in loop,
Object.keys/Object.values.
</a>
</li>
</ol>
</div>
<!-- DAY 8 -->
<div>
<button id="day8">Day 8 : Enhanced Objects Literals</button>
<ol>
<li>
<a onclick="templateLiterals()" href="#">
Use template literals to create a string that includes variable for
a person's name and age. Also create multiline string.
</a>
</li>
<li>
<a onclick="destructuring()" href="#"
>Use array destructuring to extract first and second element from an
array of numbers. Also use object destructuring to extract title and
author from a book object.
</a>
</li>
<li>
<a onclick="spreadNRest()" href="#"
>Use spread operator to create a new array that includes all the
elements of an already existing array plus additional elements. Use
rest operator in a function to accept an arbitary number of
arguments, sum them and return the result.
</a>
</li>
<li>
<a onclick="defaultParameters()" href="#"
>Write a function to take two parameters and returns their product,
with second parameter having a default value of 1.
</a>
</li>
<li>
<a onclick="enhancedObject()" href="#"
>Use an enhanced object literals to create an object with methods
and properties. Create an object with computed property names based
on variables.
</a>
</li>
</ol>
</div>
<!-- DAY 9 -->
<div>
<button id="day9">Day 9 : DOM Manipulation</button>
<ol>
<li>
<a onclick="textManipulation()" href="#"
>Select an HTML element by its ID and change its text content. Also
select an HTML element by its class and change its background color.
</a>
<p id="TextContent">Change my text content</p>
<p class="bground">Change my background color</p>
</li>
<li>
<a id="testDay9" onclick="elementCreation()" href="#"
>Create a new div element with some text content and append it to
the body. Also create a new li element and add to an existing ul
list.
</a>
<ul id="testList">
<li>List Item 1</li>
<li>List Item 2</li>
<li>List Item 3</li>
</ul>
</li>
<li>
<a onclick="elementRemoval()" href="#"
>Select an HTML element and remove it from the DOM. Remove the last
child of any specific HTML element
</a>
<p id="removeP" onclick="removeMe()">
THIS PARAGRAPH ELEMENT WILL BE REMOVED ON SELECTION
</p>
<ul id="removeE">
<li>List Item 1</li>
<li>List Item 2</li>
<li>List Item 3</li>
<li>List Item 4</li>
</ul>
</li>
<li>
<a href="#"
>Select an HTML element and change one of its attributes (e.g. src
of an img tag). Also add and remove a CSS class to/from an HTML
element</a
>
<img
id="attrib"
src="https://images.pexels.com/photos/26690027/pexels-photo-26690027/free-photo-of-atlantic-puffin-flying-over-rocks.jpeg?auto=compress&cs=tinysrgb&w=800&lazy=load"
alt=""
onclick="changeAttribute()"
/>
<button onclick="addImgClass()">Add class to above image</button>
<button onclick="removeImgClass()">
Remove class from above image
</button>
</li>
<li>
<a onclick="eventHandling()" href="#"
>Add a click event listener to a button that changes the text
content of a paaragraph. Also add a mouse event listener to an
element that changes its border color.
</a>
<button id="testEvent">Change the text content of paragraph</button>
<p id="testPara">
This text will be changed when you click the button.
</p>
</li>
</ol>
</div>
<!-- DAY 10 -->
<div>
<button id="day10">Day 10 : Event Handling</button>
<ol>
<li>
<a href="./Day10/index.html">Event handling tasks </a>
</li>
</ol>
</div>
<!-- DAY 11 -->
<div>
<button id="day11">Day 11 : Promises and Async:Await</button>
<ol>
<li>
<a href="./Day11/index.html">Activities/tasks </a>
</li>
</ol>
</div>
<!-- DAY 12 -->
<div>
<button id="day12">Day 12 : Error Handling</button>
<ol>
<li>
<a href="./Day12/index.html">Activities/tasks </a>
</li>
</ol>
</div>
<!-- DAY 13 -->
<div>
<button id="day13">Day 13 : Modules</button>
<ol>
<li>
<a href="./Day13/index.html">Activities/tasks </a>
</li>
</ol>
</div>
<!-- DAY 14 -->
<div>
<button id="day14">Day 14 : Classes</button>
<ol>
<li>
<a href="./Day14/index.html">Activities/tasks </a>
</li>
</ol>
</div>
<!-- DAY 15 -->
<div>
<button id="day15">Day 15 : Closures</button>
<ol>
<li>
<a href="./Day15/index.html">Activities/tasks </a>
</li>
</ol>
</div>
<!-- DAY 16 -->
<div>
<button id="day16">Day 16 : Recursion</button>
<ol>
<li>
<a href="./Day16/index.html">Activities/tasks </a>
</li>
</ol>
</div>
<!-- DAY 17 -->
<div>
<button id="day17">Day 17 : Data Structures</button>
<ol>
<li>
<a href="./Day17/index.html">Activities/tasks </a>
</li>
</ol>
</div>
<!-- DAY 18 -->
<div>
<button id="day18">Day 18 : Algorithms</button>
<ol>
<li>
<a href="./Day18/index.html">Activities/tasks </a>
</li>
</ol>
</div>
</body>
</html>