Created
July 21, 2017 14:24
-
-
Save zapthedingbat/aa98a9c02c2862263b9d2933dcbec1b9 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
Array.from(s.split(/\W+/) | |
.map(a => a.toLowerCase()) | |
.reduce((p, v) => p.set(v, (p.has(v)?p.get(v):0)+1), new Map()) | |
.entries() | |
) | |
.sort((a,b) => b[1]-a[1]) | |
.forEach(a => console.log(`${a[0]}:${a[1]}`)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment