Tell us what’s happening:
Right now I need to figure out how to separate each of the strings from the whole of the sentence. Right now using the .length function on the string, it counts all the letters of all the words. I figure that identifying the spaces might be useful potentially using the regular expressions or .match functions. Looking for some advice if you have some!
Your code so far
function findLongestWordLength(str) {
let x = [str];
console.log(str.length);
return str.length;
}
findLongestWordLength("The quick brown fox jumped over the lazy dog");
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36.
Challenge: Find the Longest Word in a String
Link to the challenge: