Skip to content

Instantly share code, notes, and snippets.

@rodpoblete
Created May 18, 2017 21:55
Show Gist options
  • Save rodpoblete/94c40e9b0152bafd552bfa7a6a7b3664 to your computer and use it in GitHub Desktop.
Save rodpoblete/94c40e9b0152bafd552bfa7a6a7b3664 to your computer and use it in GitHub Desktop.
Funcion para devolver largo de palabra más corta de una cadena de texto
function findShort(s) {
var sSplit = s.split(' ');
var shortWord = s.length;
for(var i = 0; i < sSplit.length; i++){
if(sSplit[i].length < shortWord){
shortWord = sSplit[i].length;
}
}
return shortWord;
}
findShort("bitcoin take over the world maybe who knows perhaps");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment