Skip to content

Commit 8d9225b

Browse files
committed
iteration ironhack-labs#2
1 parent 8d0d9c4 commit 8d9225b

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/functions-and-arrays.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,25 @@ maxOfTwoNumbers(1, 2);
88

99

1010
// Iteration #2: Find longest word
11-
// const words = ['mystery', 'brother', 'aviator', 'crocodile', 'pearl', 'orchard', 'crackpot'];
11+
const words = ['mystery', 'brother', 'aviator', 'crocodile', 'pearl', 'orchard', 'crackpot'];
1212

13-
// function findLongestWord(arrOfWords) {
14-
// if (!arrOfWords.length) {
15-
// return null;
16-
// }
13+
function findLongestWord(arrOfWords) {
14+
if (!arrOfWords.length) {
15+
return null;
16+
}
1717

18-
// let longestWord = '';
18+
let longestWord = '';
1919

20-
// arrOfWords.forEach(element => {
21-
// if (element.length > longestWord.length) {
22-
// longestWord = element;
23-
// }
24-
// });
20+
arrOfWords.forEach(element => {
21+
if (element.length > longestWord.length) {
22+
longestWord = element;
23+
}
24+
});
2525

26-
// return longestWord;
27-
// }
26+
return longestWord;
27+
}
2828

29-
// findLongestWord(words);
29+
findLongestWord(words);
3030

3131
// Iteration #3: Calculate the sum
3232
const numbers = [6, 12, 1, 18, 13, 16, 2, 1, 8, 10];

0 commit comments

Comments
 (0)