The Longest Word explainer

Aim of the puzzle: Write a function that takes an array of strings and returns the longest string in the array.
Walk through of solution: At the end of this course, you will be writing a function that takes a string and an array of strings, and returns the longest string in the array that is a subsequence of the other string.

For now, write a function that simply returns the longest string in an array of strings. This will be a useful helper function to use later.

To start, create a local variable to store the longest string. Set its value to be an empty string. You will be adding to it later in the function. For example:

let longestString = '';

Then, add a for loop to iterate through the array of strings. Inside the for loop, add an if statement that checks if the current string being looked at is longer than the longest string. It should look something like this:

    for (let word of array) {
        if (word.length > longestWord.length) {
            longestWord = word

If a word is found that is longer than longestWord, then that word is assigned to longestWord.

At the end of the function, return the longest string.
Javascript Concepts: Functions, Strings, .length, For Loops, If Statements, Arrays