Skip to content

Instantly share code, notes, and snippets.

@dragonza
Created February 12, 2018 17:34
Show Gist options
  • Save dragonza/bc9c80a0de6c711b30b51348ee4607b3 to your computer and use it in GitHub Desktop.
Save dragonza/bc9c80a0de6c711b30b51348ee4607b3 to your computer and use it in GitHub Desktop.
Create character map
const obj = {};
for (let char of str) {
obj[char] = obj[char] + 1 || 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment