function findLongestWord(str) {
let m = 0;
let array = str.split(" ");
for(var i = 0; i < array.lenght; i++){
if(array[i].length > array[m].length){
m = i;
}
}
return array[m].length;
}
findLongestWord("The quick brown fox jumped over the lazy dog");'
//where i missed? Thats retuning 3...
You misspelled length
.
1 Like
Oh thank you, i told… dumb thing…