Skip to content

Instantly share code, notes, and snippets.

@AlexanderShushunov
Last active March 8, 2017 09:38
Show Gist options
  • Save AlexanderShushunov/1d5f68a98ac2dd679ae6cacfeaa55753 to your computer and use it in GitHub Desktop.
Save AlexanderShushunov/1d5f68a98ac2dd679ae6cacfeaa55753 to your computer and use it in GitHub Desktop.
Snippet calcs most frequent letter in the string. It uses lodash.
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