Last active
February 12, 2018 17:38
-
-
Save dragonza/1b482546aa2c6f9f2a354cb2de71c469 to your computer and use it in GitHub Desktop.
Create character map
This file contains hidden or 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 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