-
-
Save bitfishxyz/68b77bb438461ce6b7ed6b4b050536b2 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 countFrequency(arr){ | |
let result = new Map(); | |
for(let element of arr){ | |
if(result.get(element)) { | |
result.set(element, result.get(element) + 1) | |
} else { | |
result.set(element, 1) | |
} | |
} | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment