Skip to content

Instantly share code, notes, and snippets.

@aksnell
Created June 25, 2020 13:16
Show Gist options
  • Save aksnell/522dedad4799780fc019d54d6ece1124 to your computer and use it in GitHub Desktop.
Save aksnell/522dedad4799780fc019d54d6ece1124 to your computer and use it in GitHub Desktop.
function count(array){
let result = {}
for (ele of array) {
result[ele] = (ele in result) ? result[ele] + 1 : 1
}
return result
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment