Find the Longest Word in a String(please monitor my code)

Tell us what’s happening:

Your code so far

function findLongestWordLength(str) {
  var longest ;
  var splitStr = str.split(" ");
  splitStr[0].length = longest;
  for (var i =0 ; i<str.length; i++){
   if (splitStr[i].length < longest){
     longest = splitStr[i].length;

  return longest;

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/67.0.3396.87 Safari/537.36.

Link to the challenge:

When does your for loop stop? What is the max value of str.length?
Looking at that might help you find your mistake!

as @Capucine said read your code carefully and u will solve your mistake. if u can’t figure it out check this spoiler


your answer is changing i<.strlength to i<splitStr.length