diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 000000000..e9c2a7c14 Binary files /dev/null and b/.DS_Store differ diff --git a/starter-code/.DS_Store b/starter-code/.DS_Store new file mode 100644 index 000000000..17d4eb54b Binary files /dev/null and b/starter-code/.DS_Store differ diff --git a/starter-code/functions-and-arrays.js b/starter-code/functions-and-arrays.js index 039bef297..d51f749ed 100644 --- a/starter-code/functions-and-arrays.js +++ b/starter-code/functions-and-arrays.js @@ -1,16 +1,25 @@ // Find the maximum -function maxOfTwoNumbers (first, second) { +function maxOfTwoNumbers(first, second){ + if (first > second) { + largest = first; + + } + else if (second > first) { + largest = second; + + } + else { + console.log("The numbers are the same"); + } + return largest; } +maxOfTwoNumbers(8, 9); var largest = maxOfTwoNumbers(2, 6); console.log(largest); // Finding Longest Word -function findLongestWord (words) { - -} - var words = [ "mystery", "brother", @@ -20,8 +29,28 @@ var words = [ "orchard", "crackpot" ]; + + var numbers = []; + var newLargestWord = 0; + +function findLongestWord(words){ + +for (i=0; i newLargestWord) { + var newLargestWord = numbers[i]; + console.log(newLargestWord) + } + +} +} + + var longest = findLongestWord(words); console.log(longest); +// crocodile // Calculating a Sum function sumArray (array) {