Okay thx I will do that next time. Also, the commas are just to prep the data coming into longestArr so it can be split and sorted in ascending order. Using spaces would have done the same thing but it was more for my sake when I was trying to read the array coming in.
Also, here is my code for reference.
function findLongestWord(str) {
var longestWord = "";
var longestArr = [];
var wordArr = str.split(" ");
for (var i = 0; i < wordArr.length; i++) {
longestArr += wordArr[i].length + " ";
}
longestArr = longestArr.split(" ").sort(function(a,b) {
return a - b;
});
longestWord = longestArr.pop();
return longestWord;
}
findLongestWord("The quick brown fox jumped over the lazy dog");