Feedback for "Find Longest Word in String"

Hi,

this is my solution:

function findLongestWordLength(str) {
  let arr = str.split(" ").sort(function(a, b){
    return a.length < b.length
  });
  return arr[0].length;
}

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

Your solutions are very clever, @c0ka and @lionel-rowe :clap:. I didn’t think about using .map() and Math.max .

1 Like