Basic Algorithm Scripting - Find the Longest Word in a String

hi there
Running this code to find the longest word in a string

function findLongestWordLength(str) {

let arr= str.split('');
let longest =0;

for( let i =0;i < arr.length;i++){

  for(let j=0; j<arr.lenght;j++){

if(arr[j].length >arr[i].length){
    longest=arr[j].length;
  }

  }
  
}
console.log(longest)
  return longest;
}

findLongestWordLength("The quick brown fox jumped over the lazy dog");

my console.log(longest ) is printing 0 which means my value is not being assigned to longest however i’m unsure as to why

There is a typo in the word length

You didn’t see any error message with this code?

Also this code will always evaluate to false.
What do you get if you try to log what arr[i] is? And arr[j]?

Try logging the statements you are using to the left and right of the greater than operator also.
(Log them just above the if statement).