how to count occurrences of each character in string in javascript

JavaScript
all occurrences in string
Source

Also in JavaScript: