Find the Longest Word in a String--having problem with split

Tell us what’s happening:
Hi, so I am trying to turn the string into an array (of words used in that sentence) so that I can have index references. I have used the coma as a separator, but the consoles (both browser and FCC) show that arr has only one element, which is the string as a whole at index 0. Not sure what went wrong here, help please. Thank you

Your code so far

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

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

Link to the challenge:

The string has no commas, which is what you said you wanted to split it on, so there’s nothing to split.

split takes a string, and breaks it into an array of one or more strings, splitting on the character you tell it you want to split on.

Edit: also, array indices go from 0+, so this is not a thing: arr[-1], arrays do not have a minus-oneth index.

Thanks, I wanted to split it into words not to single letters, is there a way to do that?

Use a space as separstor to split on spaces, if you use an empty string it will split all characters