Skip to content

Commit 82e33fe

Browse files
iteration ironhack-labs#1
1 parent bbd5108 commit 82e33fe

File tree

1 file changed

+8
-20
lines changed

1 file changed

+8
-20
lines changed

src/functions-and-arrays.js

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,35 @@
11
// Iteration #1: Find the maximum
2-
function maxOfTwoNumbers() {}
3-
4-
2+
function maxOfTwoNumbers(num1, num2) {
3+
if (num1 > num2) {
4+
return num1;
5+
} else {
6+
return num2;
7+
}
8+
}
59

610
// Iteration #2: Find longest word
711
const words = ['mystery', 'brother', 'aviator', 'crocodile', 'pearl', 'orchard', 'crackpot'];
812

913
function findLongestWord() {}
1014

11-
12-
1315
// Iteration #3: Calculate the sum
1416
const numbers = [6, 12, 1, 18, 13, 16, 2, 1, 8, 10];
1517

1618
function sumNumbers() {}
1719

18-
19-
2020
// Iteration #3.1 Bonus:
2121
function sum() {}
2222

23-
24-
2523
// Iteration #4: Calculate the average
2624
// Level 1: Array of numbers
2725
const numbersAvg = [2, 6, 9, 10, 7, 4, 1, 9];
2826

2927
function averageNumbers() {}
3028

31-
3229
// Level 2: Array of strings
3330
const wordsArr = ['seat', 'correspond', 'linen', 'motif', 'hole', 'smell', 'smart', 'chaos', 'fuel', 'palace'];
3431

35-
function averageWordLength() { }
32+
function averageWordLength() {}
3633

3734
// Bonus - Iteration #4.1
3835
function avg() {}
@@ -54,15 +51,11 @@ const wordsUnique = [
5451

5552
function uniquifyArray() {}
5653

57-
58-
5954
// Iteration #6: Find elements
6055
const wordsFind = ['machine', 'subset', 'trouble', 'starting', 'matter', 'eating', 'truth', 'disobedience'];
6156

6257
function doesWordExist() {}
6358

64-
65-
6659
// Iteration #7: Count repetition
6760
const wordsCount = [
6861
'machine',
@@ -80,8 +73,6 @@ const wordsCount = [
8073

8174
function howManyTimes() {}
8275

83-
84-
8576
// Iteration #8: Bonus
8677
const matrix = [
8778
[8, 2, 22, 97, 38, 15, 0, 40, 0, 75, 4, 5, 7, 78, 52, 12, 50, 77, 91, 8],
@@ -108,9 +99,6 @@ const matrix = [
10899

109100
function greatestProduct() {}
110101

111-
112-
113-
114102
// The following is required to make unit tests work.
115103
/* Environment setup. Do not modify the below code. */
116104
if (typeof module !== 'undefined') {

0 commit comments

Comments
 (0)