Created
November 18, 2015 19:25
-
-
Save IAmAnubhavSaini/e0041c6c2a2404d7d6c8 to your computer and use it in GitHub Desktop.
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 findLongestWord(str) { | |
return str.split(' ').sort(function(a, b){ return a.length - b.length;}).pop().length; | |
} | |
findLongestWord("The quick brown fox jumped over the lazy dog"); | |
findLongestWord("What if we try a super-long word such as otorhinolaryngology") ; | |
findLongestWord("What is the average airspeed velocity of an unladen swallow"); | |
findLongestWord("Google do a barrel roll"); | |
findLongestWord("May the force be with you"); | |
findLongestWord("The quick brown fox jumped over the lazy dog"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment