Finding the Longest Word in a String
You are creating an array of strings (using str.split(" ")) as well as an array of numbers (wordLengthArray), then sorting wordLengthArray.  All three of those operations are wasteful, if you are aiming for performance.



function findLongestWordLength(str) {
  let maxLen = -1;
  for (var i = 0, j; (j = str.indexOf(" ", i)) != -1; i = j + 1) {
    maxLen = Math.max(maxLen, j - i);
  }
  return Math.max(maxLen, str.length - i);
}

console.log(6 == findLongestWordLength("The quick brown fox jumped over the lazy dog"));
console.log(5 == findLongestWordLength("May the force be with you"));
console.log(6 == findLongestWordLength("Google do a barrel roll"));
console.log(8 == findLongestWordLength("What is the average airspeed velocity of an unladen swallow"));
console.log(19 == findLongestWordLength("What if we try a super-long word such as otorhinolaryngology"));




Depending on the browser/interpreter, your function is 33% to 86% slower than mine.