Tell us what’s happening:
Describe your issue in detail here.
Hello. Could someone tell me what’s wrong with my code. The test is not passing and the console keeps printing 1.
**Your code so far**
function findLongestWordLength(str) {let words = str.split("");
let maxLength = 0;
for (let i = 0; i < words.length; i++){if (words[i].length > maxLength){maxLength = words[i].length;}}
return maxLength;
}
console.log(findLongestWordLength("The quick brown fox jumped over the lazy dog"));
**Your browser information:**
User Agent is: Mozilla/5.0 (iPhone; CPU iPhone OS 15_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.4 Mobile/15E148 Safari/604.1
Challenge: Find the Longest Word in a String
Link to the challenge: