Skip to content

Instantly share code, notes, and snippets.

@sonbyungjun
Created June 2, 2020 02:32
Show Gist options
  • Save sonbyungjun/906c7ca314e222b212fbdb46dd067d97 to your computer and use it in GitHub Desktop.
Save sonbyungjun/906c7ca314e222b212fbdb46dd067d97 to your computer and use it in GitHub Desktop.
TypeScript(Javascript) duplicateCheck Function (타입스크립트(자바스크립) 중복체크 함수)
export function duplicateCheck(array: any[]) {
return array.reduce((t, a) => {
t[a] = (t[a] || 0) + 1;
return t
}, {})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment