Skip to content

Instantly share code, notes, and snippets.

@manabuyasuda
Created June 21, 2022 09:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save manabuyasuda/c0fe6fb0002629a785fdcef828d2123c to your computer and use it in GitHub Desktop.
Save manabuyasuda/c0fe6fb0002629a785fdcef828d2123c to your computer and use it in GitHub Desktop.
/**
* 配列を比較して、1つでも重複があれば`true`を返す
* @param {Array} arr1
* @param {Array} arr2
* @returns {Boolean}
*/
const isDuplicateArray = (arr1, arr2) => {
return (
[...arr1, ...arr2].filter(item => arr1.includes(item) && arr2.includes(item)).length > 0
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment