Tell us what’s happening:
je comprends pas trop pourquoi ça ne fonctionne pas?
Your code so far
function findLongestWordLength(sentence){
let word=sentence.trim().split(' ')
let maxLength=word[0].length
for (let i=1;i<=word.length;i++){
if(maxLength<word[i].length){
maxLength=word[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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36 Edg/143.0.0.0
Challenge Information:
Build a Longest Word Finder App - Build a Longest Word Finder App