Find the Longest Word in a String - Why is my code not working?

Find the Longest Word in a String - Why is my code not working?
0

#1

Tell us what’s happening:

Your code so far





function findLongestWordLength(str) {

 var strArr = str.split(' ');

 var longestWord = 0;

 for ( var row = 0 ; row<strArr.length ; row++) {
if (strArr[row].length  > longestWord){

longestWord = strArr[row].length;

}
 }




return longestWord;

}







  

  
}

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/68.0.3440.106 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting/find-the-longest-word-in-a-string


#2

Typical realised the extra } as soon as I posted! SOrry, mods please delete