Basic Algorithm Scripting - Find the Longest Word in a String

Tell us what’s happening:

I have tried so many examples but to no solution. am stuck here.
FIND THE LONGEST WORD
OF A STRING

Your code so far

function findLongestWordLength(str) {
  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/123.0.0.0 Safari/537.36 Edg/123.0.0.0

Challenge Information:

Basic Algorithm Scripting - Find the Longest Word in a String

For any of the algorithm challenges, I always advise beginners to write down their approach in plain english before writing 1 line of code.

That way, you can better understand the problem and slowly code it out.

So how would you describe your approach in plain english(no code)?

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.