Created
November 28, 2018 16:54
-
-
Save danielvanc/0e0ef0a8bdbd336a9ce9d89b1f4d2dd8 to your computer and use it in GitHub Desktop.
Return length of shortest word from words in a string
This file contains 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 shortestWord(str) { | |
return Math.min.apply(null, str.split(' ').map(w => w.length)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment