Please help.I dont know what went wrong?

Tell us what’s happening:

Your code so far


function findLongestWordLength(str) {
str = str.split(" ");
if (str.length == 1) {
return str[0].length;
}

findLongestWordLength("The quick brown fox jumped over the lazy dog");
}
if (str[0].length >= str[1].length) {
str.splice(1, 1);
return findLongestWordLength(str.join(" "));
}
if (str[0].length <= str[1].length) {
return findLongestWordLength(str.slice(1, str.length).join(" "));
}

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36.

Challenge: Find the Longest Word in a String

Link to the challenge:

If you remove findLongestWordLength("The quick brown fox jumped over the lazy dog"); } from the middle of the function, it will pass. This is the function call and should go after the function has been defined.