Find longest word in a string - problem with my code

Could someone tell me whats wrong with this?

function findLongestWordLength(str) {
  var arr = str.split(" ")
  var max=arr[0].length;
  for (i=1; i<arr.length;i++){
  if (arr[i].length>max){
    max = arr[i].length;
  }
  }
  return str.length=max;
}

findLongestWordLength("What if we try a super-long word such as otorhinolaryngology");

Thanks a lot. I will remember these in the future. :grinning::grinning: