Skip to content

Instantly share code, notes, and snippets.

View potterman69's full-sized avatar
🥱
Vibing

Potter Man potterman69

🥱
Vibing
View GitHub Profile
@potterman69
potterman69 / index.js
Created August 2, 2022 16:43
Array Element Occurence Snippet (Muhammad Ahsan)
const arrExample = [5,5,2,2,1]
let occurence = {}
arrExample.forEach((item) => {
if(Object.keys(occurence).includes(item.toString())){
occurence[item] = occurence[item] + 1
} else occurence[item] = 1
})