Last active
March 5, 2018 09:34
-
-
Save c7x43t/a7b18d69b7ddec8d66b382759d9a38c5 to your computer and use it in GitHub Desktop.
This file contains 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
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