Sort array of strings by length of words

PHOTO EMBED

Thu Sep 28 2023 14:22:24 GMT+0000 (Coordinated Universal Time)

Saved by @Paloma

function findShort(s){
  return s.split(" ").sort(function(a, b) {
  return a.length - b.length || a.localeCompare(b);    
})[0].length }

//ALTERNATIVE

function findShort(s){
    return Math.min(...s.split(" ").map (s => s.length));
}
content_copyCOPY

https://www.codewars.com/kata/57cebe1dc6fdc20c57000ac9/solutions/javascript