JSFiddle - React, Tailwind, and code Playground
by LuckyCat
JavaScript
function findShort2(str) {
let lengthShort = str.split(' ').reduce((shortestWord, currentWord) => {
return currentWord.length < shortestWord.length ? currentWord : shortestWord;
});
console.log("Длина самого короткого слова: " + lengthShort.length);
return lengthShort.length;
}
findShort2("bitcoin take over the world maybe who knows perhaps");