I'm a code newbie and I was given a challenge to find the longest word in an array of strings. I followed an example for finding the longest string in a sentence and came up with this:
function longestString(strs) {
return strs.sort(function(a, b) {return b.length - a.length})[0];
}
longestString('boop', 'bloomburg', 'hello');
it didn't work, and I don't know what's wrong