Today we are going to write a function called
getLongestWords that will accept a string,
text, as an argument.
The goal of the function is to return an array containing the longest word (or words) in a string. It is ok for the array to have multiple words if they are the same word length and that word length also is the largest.
let text = "Everyone should learn how to program a computer because it teaches you how to think"; getLongestWords(text) // output: ["Everyone", "computer"]
The longest word in the string is
"Everyone" but since
"computer" also has the same word length, both strings are added to the array.