Skip to content

Instantly share code, notes, and snippets.

@c7x43t
Last active March 5, 2018 09:34
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 c7x43t/a7b18d69b7ddec8d66b382759d9a38c5 to your computer and use it in GitHub Desktop.
Save c7x43t/a7b18d69b7ddec8d66b382759d9a38c5 to your computer and use it in GitHub Desktop.
function arrayHistogram(arr){
const obj={};
for(let i=0;i<arr.length;i++){
if(!obj.hasOwnProperty(arr[i])) obj[arr[i]]=0;
obj[arr[i]]++;
}
return obj;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment