Skip to content

Instantly share code, notes, and snippets.

@dragonza
Last active February 12, 2018 17:38
Show Gist options
  • Save dragonza/1b482546aa2c6f9f2a354cb2de71c469 to your computer and use it in GitHub Desktop.
Save dragonza/1b482546aa2c6f9f2a354cb2de71c469 to your computer and use it in GitHub Desktop.
Create character map
const obj = {};
str.split('').forEach(char => obj[char] + 1 || 1); // remember to turn the given string into array first as forEach is Array prototype
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment