var newStr = str.split(" ").sort(function(a, b) {
return a.length - b.length;
});
return newStr.pop().length;
}
thats literally all it was?
var newStr = str.split(" ").sort(function(a, b) {
return a.length - b.length;
});
return newStr.pop().length;
}
thats literally all it was?
That’ll do it. Under the covers it’s not the most time-efficient way to solve it, but it’s a perfectly good answer.