Have the function LongestWord(sen) take the sen parameter being passed and return the largest word in the string. If there are two or more words that are the same length, return the first word from the string with that length. Ignore punctuation and assume sen will not be empty.
Input: "fun&!! time" Output: time
Input: "I love dogs" Output: love
function LongestWord(sen) { const words = sen.split(' '); let maxWord = ''; let max = 0; for (let word of words) { const filteredWord = word.replace(/[^a-zA-Z0-9]/gi, ''); if (filteredWord.length > max) { maxWord = filteredWord; max = filteredWord.length; } } // code goes here return maxWord; }