Skip to content

Instantly share code, notes, and snippets.

@QuatoHub
Created September 6, 2021 13:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save QuatoHub/1775e082e75db6fea8216392ce80cb5b to your computer and use it in GitHub Desktop.
Save QuatoHub/1775e082e75db6fea8216392ce80cb5b to your computer and use it in GitHub Desktop.
function countAllCharacters(str) {
let obj = {};
for(let i = 0; i < str.length; i++){
if (obj[str[i]] === undefined) {
obj[str[i]] = 0
}
obj[str[i]]++
}
return obj;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment