We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c4f4d5a commit 61644c5Copy full SHA for 61644c5
starter-code/src/functions-and-arrays.js
@@ -1,4 +1,8 @@
1
-// Find the maximum
+// Find the maximu
2
+
3
+function maxOfTwoNumbers(num1, num2) {
4
+ return Math.max(num1, num2)
5
+}
6
7
// Finding Longest Word
8
var words = [
@@ -9,7 +13,28 @@ var words = [
9
13
'pearl',
10
14
'orchard',
11
15
'crackpot'
12
-];
16
+];
17
+function findLongestWord(words){
18
+ for(var i = 0; i < words.length; i++) {
19
+ var longest = words[i].length;
20
+ if (words[i].length > longest) {
21
+ longest = words[i]
22
+ }
23
24
+ return longest
25
26
+findLongestWord(words)
27
28
+ console.log(words)
29
30
31
+findLongestWord(['mystery',
32
+ 'brother',
33
+ 'aviator',
34
+ 'crocodile',
35
+ 'pearl',
36
+ 'orchard',
37
+ 'crackpot' ]);
38
39
// Calculating a Sum
40
0 commit comments