-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex-11.html
106 lines (103 loc) · 5.38 KB
/
index-11.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Abril+Fatface&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400&display=swap" rel="stylesheet">
<link
rel="stylesheet"
href="https://use.fontawesome.com/releases/v5.8.1/css/all.css"
integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf"
crossorigin="anonymous"
/>
<link rel="stylesheet" href="assets/css/style.css">
<link rel="shortcut icon" type="image/jpg" href="assets/images/favicon.png">
<title>JavaScriptmas | Challenge 11</title>
</head>
<body>
<header>
<a href="index.html"><img src="assets/images/header.png" height="100px" width="400px" alt="Jessica's JavaScriptmas Challenge"></a>
<br><br>
<button class="challenge-icon"><a href="index-1.html">1</a></button>
<button class="challenge-icon"><a href="index-2.html">2</a></button>
<button class="challenge-icon"><a href="index-3.html">3</a></button>
<button class="challenge-icon"><a href="index-4.html">4</a></button>
<button class="challenge-icon"><a href="index-5.html">5</a></button>
<button class="challenge-icon"><a href="index-6.html">6</a></button>
<button class="challenge-icon"><a href="index-7.html">7</a></button>
<button class="challenge-icon"><a href="index-8.html">8</a></button>
<button class="challenge-icon"><a href="index-9.html">9</a></button>
<button class="challenge-icon"><a href="index-10.html">10</a></button>
<button class="challenge-icon"><a href="index-11.html">11</a></button>
<button class="challenge-icon"><a href="index-12.html">12</a></button>
<button class="challenge-icon"><a href="index-13.html">13</a></button>
<button class="challenge-icon"><a href="index-14.html">14</a></button>
<button class="challenge-icon"><a href="index-15.html">15</a></button>
<button class="challenge-icon"><a href="index-16.html">16</a></button>
<button class="challenge-icon"><a href="index-17.html">17</a></button>
<button class="challenge-icon"><a href="index-18.html">18</a></button>
<button class="challenge-icon"><a href="index-19.html">19</a></button>
<button class="challenge-icon"><a href="index-20.html">20</a></button>
<button class="challenge-icon"><a href="index-21.html">21</a></button>
<button class="challenge-icon"><a href="index-22.html">22</a></button>
<button class="challenge-icon"><a href="index-23.html">23</a></button>
<button class="challenge-icon"><a href="index-24.html">24</a></button>
</header>
<main>
<h1>11. Avoid Obstacles</h1>
<br>
<p>
Create an array of integers. Each number in your array represents the coordinates of an obstacle on a straight line.
<br><br>
Find the smallest number that can 'jump' through your array without hitting an obstacle.
<br><br>
<strong>Example: </strong> The result of the array [5, 3, 6, 7, 9] would be 4.
<br><br>
</p>
<a id="explanation-link" href="#explanation">Click for further explanation of example</a>
<p id="explanation" class="hide">
<br>
A jump of 1 creates the jump sequence: 1, 2, 3, 4, 5, etc., meaning it will hit all obstacles.
<br><br>
A jump of 2 creates the sequence: 2, 4, 6, 8, 10, etc, meaning it hits the obstacle at coordinate 6.
<br><br>
A jump of 3 creates the sequence: 3, 6, 9, 12, 15, etc, meaning it hits the obtacles at coordintes 3, 6, and 9.
<br><br>
A jump of 4 creates the sequence: 4, 8, 12, 16, 18, etc, meaning it does not hit any of the obstacles.
</p>
<br><br>
<h3>Array of Integers: [<span id="integer-arr"></span>]</h3>
<br>
<form>
<label for="num">Add item to array: </label>
<br>
<input id="num" type="number" placeholder="e.g. 8">
<button id="submit-num" type="submit">Add</button><br>
</form>
<p class="note">*Note: Numbers with decimal places will be rounded down.</p>
<br>
<form>
<button id="submit" class="input-width-btn result-btn" type="submit">Find Smallest Jump</button>
</form>
<br><br>
<h3>Smallest jump to avoid all obstacles: <span id="jump"></span></h3>
<br><hr><br>
<div class="arrow-div">
<div class="prev-arrow">
<button class="arrow-btn" onclick="window.location.href='index-10.html'">
<i class="fas fa-chevron-left"></i> Previous
</button>
</div>
<div class="next-arrow">
<button class="arrow-btn" onclick="window.location.href='index-12.html'">
Next <i class="fas fa-chevron-right"></i>
</button>
</div>
</div>
</main>
<script type="text/javascript" src="assets/js/script.js"></script>
<script type="text/javascript" src="assets/js/script-11.js"></script>
</body>
</html>