/uniqField

A simple script for searching for unique values ​​in the fields of an object array.

Primary LanguageJavaScript

A simple script for searching for unique values ​​in the fields of an object array.

  • mainArr - an array of objects with arbitrary fields:

    • id - arbitrary serial number of the object

    • fieldArr - object field with data that will be checked for uniqueness

  • uniqArr - an array where unique values ​​from fieldArr of all objects will be output

The code is very simple, but allows you to find only unique values ​​in data arrays.