Skip to content

Commit 8d0d9c4

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

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

src/functions-and-arrays.js

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,32 @@
11
// Iteration #1: Find the maximum
2-
function maxOfTwoNumbers() {}
2+
function maxOfTwoNumbers(num1, num2) {
3+
return num1 > num2 ? num1 : num2;
4+
}
5+
6+
maxOfTwoNumbers(1, 2);
37

48

59

610
// Iteration #2: Find longest word
7-
const words = ['mystery', 'brother', 'aviator', 'crocodile', 'pearl', 'orchard', 'crackpot'];
11+
// const words = ['mystery', 'brother', 'aviator', 'crocodile', 'pearl', 'orchard', 'crackpot'];
12+
13+
// function findLongestWord(arrOfWords) {
14+
// if (!arrOfWords.length) {
15+
// return null;
16+
// }
17+
18+
// let longestWord = '';
819

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

26+
// return longestWord;
27+
// }
1128

29+
// findLongestWord(words);
1230

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

0 commit comments

Comments
 (0)