Tell us what’s happening:
What do you think ? What’s wrong ? I was thinking that using for loop and if condition is enough to check all the cases

Your code so far
function findLongestWordLength(str) {
const arr = str.split(" ");
console.log(arr)
let longmax = 0;
for (let i = 0 ; i < arr.length -1 ; i++){
if (arr[i].length > arr[i+1].length){
longmax = arr[i].length;
}else if(arr[i].length <= arr[i+1].length){
longmax = arr[i+1].length;
}
}
return longmax;
}
findLongestWordLength("The quick brown fox jumped over the lazy dog");
console.log(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/89.0.4389.72 Safari/537.36 Edg/89.0.774.45.
Challenge: Find the Longest Word in a String
Link to the challenge:
