Last active
March 8, 2017 09:38
-
-
Save AlexanderShushunov/1d5f68a98ac2dd679ae6cacfeaa55753 to your computer and use it in GitHub Desktop.
Snippet calcs most frequent letter in the string. It uses lodash.
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
const _ = require('lodash'); | |
let result = _("qwerwererrr") | |
.groupBy() | |
.map((value, key) => ({key, length: value.length})) | |
.maxBy(_ => _.length) | |
.key; | |
console.log(result); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment