Skip to content

Instantly share code, notes, and snippets.

@oleg-koval
Created August 3, 2018 12:21
Show Gist options
  • Save oleg-koval/c678f9d5d2d6d196f595a7e822912494 to your computer and use it in GitHub Desktop.
Save oleg-koval/c678f9d5d2d6d196f595a7e822912494 to your computer and use it in GitHub Desktop.
Reduce usage: findLongestWordLength
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