Build a Longest Word Finder App - Build a Longest Word Finder App

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

Bonjour @descartesnguimbous1

Pour vous aider à déboguer, essayez d’afficher dans la console chaque affectation de variable et la condition « if ».

Bon codage !

j’ai reussi a trouvé l’erreur merci

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.