Created
July 6, 2017 07:03
-
-
Save AndrewAllison/8bef0744030b85607018f705729d6d89 to your computer and use it in GitHub Desktop.
Javascript snippits
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
// Find the shortest word in an arra of words | |
// Example "Some so WOrds Will Be Longer" would return 2 | |
function findShort(s){ | |
return Math.min.apply(null, s.split(' ').map(w => w.length)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment