Created
February 17, 2020 04:29
-
-
Save bitfishxyz/5a82992cfb5ff2fd08038c38ea73bda2 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 count(arr){ | |
let result = new Map(); | |
for(let ele of arr){ | |
if (result.get(ele) == undefined) { | |
result.set(ele, 1); | |
} else { | |
result.set(ele, result.get(ele) + 1); | |
} | |
} | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment