Created
August 3, 2018 12:21
-
-
Save oleg-koval/c678f9d5d2d6d196f595a7e822912494 to your computer and use it in GitHub Desktop.
Reduce usage: findLongestWordLength
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 findLongestWordLength(str) { | |
return str.split(' ').reduce((prev, curr) => { | |
if (prev.length > curr.length) { | |
return prev | |
} | |
return curr | |
}).length; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment