2
2
function maxOfTwoNumbers ( ) { }
3
3
4
4
5
+
5
6
// Iteration #2: Find longest word
7
+ const words = [ 'mystery' , 'brother' , 'aviator' , 'crocodile' , 'pearl' , 'orchard' , 'crackpot' ] ;
6
8
7
9
function findLongestWord ( ) { }
8
10
9
- const words = [ 'mystery' , 'brother' , 'aviator' , 'crocodile' , 'pearl' , 'orchard' , 'crackpot' ] ;
10
11
11
- // Iteration #3: Calculate the sum
12
12
13
+ // Iteration #3: Calculate the sum
13
14
const numbers = [ 6 , 12 , 1 , 18 , 13 , 16 , 2 , 1 , 8 , 10 ] ;
14
15
15
16
function sumNumbers ( ) { }
16
17
18
+
19
+
20
+ // Iteration #3.1 Bonus:
21
+ function sum ( ) { }
22
+
23
+
24
+
17
25
// Iteration #4: Calculate the average
18
26
// Level 1: Array of numbers
19
27
const numbersAvg = [ 2 , 6 , 9 , 10 , 7 , 4 , 1 , 9 ] ;
20
28
21
29
function averageNumbers ( ) { }
22
30
31
+
23
32
// Level 2: Array of strings
24
33
const wordsArr = [ 'seat' , 'correspond' , 'linen' , 'motif' , 'hole' , 'smell' , 'smart' , 'chaos' , 'fuel' , 'palace' ] ;
25
34
35
+
36
+
26
37
// Iteration #5: Unique arrays
27
38
const wordsUnique = [
28
39
'crab' ,
@@ -40,11 +51,15 @@ const wordsUnique = [
40
51
41
52
function uniquifyArray ( ) { }
42
53
54
+
55
+
43
56
// Iteration #6: Find elements
44
57
const wordsFind = [ 'machine' , 'subset' , 'trouble' , 'starting' , 'matter' , 'eating' , 'truth' , 'disobedience' ] ;
45
58
46
59
function doesWordExist ( ) { }
47
60
61
+
62
+
48
63
// Iteration #7: Count repetition
49
64
const wordsCount = [
50
65
'machine' ,
@@ -62,8 +77,9 @@ const wordsCount = [
62
77
63
78
function howManyTimes ( ) { }
64
79
65
- // Iteration #8: Bonus
66
80
81
+
82
+ // Iteration #8: Bonus
67
83
const matrix = [
68
84
[ 8 , 2 , 22 , 97 , 38 , 15 , 0 , 40 , 0 , 75 , 4 , 5 , 7 , 78 , 52 , 12 , 50 , 77 , 91 , 8 ] ,
69
85
[ 49 , 49 , 99 , 40 , 17 , 81 , 18 , 57 , 60 , 87 , 17 , 40 , 98 , 43 , 69 , 48 , 4 , 56 , 62 , 0 ] ,
@@ -89,12 +105,17 @@ const matrix = [
89
105
90
106
function greatestProduct ( ) { }
91
107
92
- // The following is required to make unit tests work. Please ignore it.
108
+
109
+
110
+
111
+ // The following is required to make unit tests work.
112
+ /* Environment setup. Do not modify the below code. */
93
113
if ( typeof module !== 'undefined' ) {
94
114
module . exports = {
95
115
maxOfTwoNumbers,
96
116
findLongestWord,
97
117
sumNumbers,
118
+ sum,
98
119
averageNumbers,
99
120
uniquifyArray,
100
121
doesWordExist,
0 commit comments