Created
May 18, 2017 21:55
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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