/*Description:
Simple, given a string of words, return the length of the shortest word(s).
String will never be empty and you do not need to account for different data types.
*/
function findShort(s){
let strArr = s.split(" ");
let minLength = strArr[0].length;
for(let i = 1; i < strArr.length; ++i){
minLength = Math.min(minLength, strArr[i].length);
}
return minLength;
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter