Skip to content

Instantly share code, notes, and snippets.

@danielvanc
Created November 28, 2018 16:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielvanc/0e0ef0a8bdbd336a9ce9d89b1f4d2dd8 to your computer and use it in GitHub Desktop.
Save danielvanc/0e0ef0a8bdbd336a9ce9d89b1f4d2dd8 to your computer and use it in GitHub Desktop.
Return length of shortest word from words in a string
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