Different Longest Word in a String Solution

I got a solution that works but I want to know how it stacks up to the solutions that are shown.
This is what I did.

function findLongestWord(str) {
 var longToShort = str.split(' ').sort(function(a, b) {
    return b.length - a.length;
  });

  return longToShort[0].length;
}

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

oh! I’m sorry. That wasn’t my intention. I guess I wasn’t clear on what I was looking for. I was hoping someone could give some understanding on why this isn’t a suggested way to solve this and what issues I could encounter from doing this way.

Is it more work for the program to have to sort the entire array, especially if it is very large, rather than starting on the first element and checking one at a time like in the “advance solution”?