Skip to content

Instantly share code, notes, and snippets.

@funnythingz
Created June 14, 2020 06:16
Show Gist options
  • Save funnythingz/245e44f7ddd13f31076ed003fa80f298 to your computer and use it in GitHub Desktop.
Save funnythingz/245e44f7ddd13f31076ed003fa80f298 to your computer and use it in GitHub Desktop.
多次元配列の重複削除も可
const compact = v => v.filter((vv, index, array) => (index === array.findIndex((vvAnother) => (JSON.stringify(vv) === JSON.stringify(vvAnother)))))
@funnythingz
Copy link
Author

フツーの配列の場合はこれでいける

const compact = v => Array.from(new Set(v));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment