unique objects in array javascript

const data = [
  { group: 'A', name: 'SD' }, 
  { group: 'B', name: 'FI' }, 
  { group: 'A', name: 'MM' },
  { group: 'B', name: 'CO'}
];
const unique = [...new Set(data.map(item => item.group))]; // [ 'A', 'B']

4
1
Awgiedawgie 440215 points

                                    const array =
  [
    { "name": "Joe", "age": 17 },
    { "name": "Bob", "age": 17 },
    { "name": "Carl", "age": 35 }
  ]

const key = 'age';

const arrayUniqueByKey = [...new Map(array.map(item =>
  [item[key], item])).values()];

console.log(arrayUniqueByKey);

   /*OUTPUT
       [
        { "name": "Bob", "age": 17 },
        { "name": "Carl", "age": 35 }
       ]
   */

 // Note: this will pick the last duplicated item in the list.

4 (1 Votes)
0
4
8
Krish 100200 points

                                    const array = [    { id: 3, name: 'Central Microscopy', fiscalYear: 2018 },    { id: 5, name: 'Crystallography Facility', fiscalYear: 2018 },    { id: 3, name: 'Central Microscopy', fiscalYear: 2017 },    { id: 5, name: 'Crystallography Facility', fiscalYear: 2017 }  ];const result = [];const map = new Map();for (const item of array) {    if(!map.has(item.id)){        map.set(item.id, true);    // set any value to Map        result.push({            id: item.id,            name: item.name        });    }}console.log(result)

4 (7 Votes)
0
4.13
8
Awgiedawgie 440215 points

                                    function unique(array, propertyName) {
   return array.filter((e, i) => array.findIndex(a => a[propertyName] === e[propertyName]) === i);
}

4.13 (8 Votes)
0
3.8
5
Awgiedawgie 440215 points

                                    //ES6
let array = [
  { "name": "Joe", "age": 17 },
  { "name": "Bob", "age": 17 },
  { "name": "Carl", "age": 35 }
];
array.map(item => item.age)
  .filter((value, index, self) => self.indexOf(value) === index)

> [17, 35]

3.8 (5 Votes)
0
4
6
Awgiedawgie 440215 points

                                    const categories = ['General', 'Exotic', 'Extreme', 'Extreme', 'General' ,'Water', 'Extreme']
.filter((value, index, categoryArray) => categoryArray.indexOf(value) === index);

This will return an array that has the unique category names
['General', 'Exotic', 'Extreme', 'Water']

4 (5 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
Javascript array get distinct objects get unique values from an object javascript javascript get unique from array of objects unique array of objects javascript using filter javascript make unique array of objects js get distinct values from 2 arrays unique array with object how to get distinct values from array javascrtipt distinct in array in javascript unique objects in array javascript using map object unique name return in js javascript array distinct elements unique object in array javascript js get unique objects from array of objects how to get whole unique object in array in javascript how to create a array with unique object in javascript get unique values from Object display distinct values from from column in javascript display distinct values from from column in javascript how to display distinct values from from column in javascript make objects array unique javascript distinct values from array of objects make array of objects unique js filter array to return unique values using field in object filter array of object based on unique value javascript new set unique objects javascript get distinct list get all the unique values in object array array from unique keys in array of objectd nodejs get unique from array object returning a array with distinct values in javascript javascript get distinct attributes from objects in array unique array objects js distinct element in javascript array how to distinct value from array in node js js map object by unique value js return unique string from array of objects how to get unique from objects of arrays in javascript by taking two values how to get unique from objects of arrays in javascript get unique values from array of objects typescript Javascript distinct values in object array set array distinct javascript distinct javascript array set javascript set unique objects make array of objects unique array object unique distinct elements in array js get distinct values js array get distinct values javascript js unique array of collections based on property distinct values in array javsacript javascript create distinct array return distinct value from array javascript return distinct values from array javascript distinct value in javascript array how to make unique id array of object javascript count distinct in array js unique objects js unique object array get distinct list of array javascript javascript return unique values from array filter unique values in array of objects javascript get unique values from object js array javascript distinct js array unique by property how to get the distinct elments of two arrays in node js filter unique objects in array javascript by id js set of objects unique how to find unique id in array with objects js array of objects with unique property how to javascript get distinct values from array of objects es6 unique array of objects fastest way to find distinct values in array how to get unique values from an array of objects in javascript array count distinct values javascript javascript get distinct of object in array distinct values of array get distinct values in array javascript JS how get unique fields from array of ojects get unique values from object javascript Filter unique values from an array of objects js distinct array selection unique by object using string array es get distinct values from list javascript unique object array javascript distinct values nodejs unique array of obj in js get unique values in object array nodejs find unique objects based on value in array javascript find unique objects based on value in array javascript get unique keys from array of objects filter to get distinct values in javascript array how to get unique object from array in javascript javascript get unique keys of object object array unique javascript javascript Set(array) unique objects how to create new distinct array javascript distinct array javascritpt js filter array of objects unique how to pass unique object in array in javascript js object array get unique objects get unique values in aray of objects javascript get distinct value sjavascript distinct items in array javascript unique object from array of objects javascript unique values from array of objects javascript array to return distinct array node js array to return distinct array get unique values in array of objects based on id and return value get unique values in array of objects based on id find unique object in array javascript get unique values in object javascript how to find unique values from array of object and store it in different array in js js unique objects value in array javascript array count distinct how to get distinct values from array in javascript array of unique objects javascript type script distinct values from array javascript distinct values from array javascript array of objects filter unique find unique objects in array javascript new set javascript unique values full object get unique items from array based on id javascript map array of objects get unique values objects map array of objects get unique values map array of objects and return unique array get unique objects javascript get distinct elements from array js javscript get unique values from array of objects how to filter unique objects in an array javascript get unique numbers and stores in object array in javascript filter unique from array of objects javascript how to get unique array of objects in javascript javascript get distinct from list how to get unique values from array of objects in javascript count unique objects in an array javascript count unique objects in array javascript javascript array distinct items how to get the count of distinct values in javascript array how to map a javascript object and get all unique object with key how to map a javascript object and get all unique object get unique objects from array javascript unique array of object with all keys make array of object unique find unique values of props from array of objects get unique values from array of objec javscript get unique values from array of objec js js get unique values from array of objec javascript get unique values from array of objec javascript get unique values from array of object js get unique values from array of object get unique values from array of object js get unique values from array of object javacript get unique values from array of objects javacript java script get unique values from array of objects get unique values from array of objects js js unique set of objects create unique array of objects in javascript get unique object from array in js js get distinct values from array of objects make array with distinct elements how to find distinct values in an array in javascript javascript es6 unique array of objects hot to get unique object array how to get distinct values from array in typescript javascript to get unique values from object get all unique values for property in array of objects javascript javascript unique object unique array of objects javascript unique set of objects filter unique array in array objects javascript unique object keys in array javascript js return only unique values from an arrays of objects get all unique objects from array javascript unique items in array based on object properties how to return unique objects from an array js javascript find distinct values in javascript object get distinct values javascript array javascript find distinct values in array array of objects make unique find unique objects in array javascript by object values create unique set of array of objects js select unique ids from array of objects javascript array in unique object es6 get unique result from array of objects es6 get unique objects from array of objects js finding object with any matching unique values in array unique array object in javascript a array of ojjects unique how to make array of objects unique js how to make array of objects unique distinct javascript array js array of objects get unique how to filter unique objects in array in javascript get all unique values from array of objects javascript how to filter unique object from array in javascript find unique elements in array of objects javascript how to get unique id id from array of objects in javascript javascript distinct array set get unique object from array of object es6 create unique object from array of object es6 how to make unique data object array in javascript get distinct values from list in javascript javascript set of objects unique filter unique item from array of object find unique item from array of object find unique values from array of objects node js unique array of objects how to get unique values from object array in javascript js array save unique objects distinct elements in array javascript create unique arrray of object get only unique objects from array javascript filter unique array of objects javascript set of unique objects javascript array javascript array unique objects javascript array get unique objects javascript distinct items in array javascript filter unique objects in array js find unique objects js find unique values in array of objects get objects with distinct key in an array in js get unique by object in js generate unique array of objects generate unique array of array of objects unique objects in an array js how to find unique values in array of objects using javascript show only unique obj array javascript function to find distinct element in array javascript filter array unique objects javascrip is unique array of objects js unique array of objects by key get unique value from object javascript get unique key in array of objet javascript make array object unique with javascript es6 how to create unique string array from object array in unique field values in javascript js get unique objects in array get unique values from array of object javascript array of object make unique javascript object array get unique values of field javascript distinct on array javascript program to get distinct values from array how to find distinct number in an array how to have unique array of objet get unique values from an array of objects in javascript javascript get distinct and latest values from array of objects array of object unique how to get distinct value in js distinct elelment in array node js get distinct values from array object javascript js function to get distinct values between two arrays javascript distinct in array make unique array of objects javascript js get unique objects output distinct values JS array object get unique values javascript set of unique objects javascript javascript array distinct values in array javascript get distinct objects from array how to get all unique values from an object in javascript distinct elements javascript how to find distinct elements in an array in javascript pick unique value from array of objecr convert array to distinct javascript get all distinct values in array javascript array get distinct value distinct in javascript array supparate the unique objects in an array in javascript select distinct values from js object array distinct all from an array javascript how to get distinct values from subarray in javascript get distinct from array javascript distinct array elements in js how to take distinct key from array in javascript distinct list of values js return the number of distinct elements in the array in javascript return the number of distinct elements in the array. in javascript javascript array Distinct distinct array javascript set best way get distinct values array javascript es6 best way get distinct values array javascript find distinct values in array in javascrpt how to get distinct values from an array in javascript find distinct in an array javascript print the distinct elements in an array using Js distinct data array javascript array distinct js js select distinct from array how to find distinct numbers in array distinct elements in an array how to make ann array distinct in javascript how to get distinct elements in array get distinct js select distinct from array javascript get distinct values in js javascript check distinct values of associate array javascript check distinct values of array get distinct list js js get distinct array get distinct values from array typescript find distinct elements in array javascript filter distinct values javascript javascript select distinct from array of objects find distinct elements in array js array distinct values select distinct key value pair in an array using javscript distinct from array javascript javascript distinct values array to distinct array javascript typescript get distinct values from array getting distinct value from array in js javascript equivalent of distinct filter unique objects js distinct array js distinct values from array in javascript how to get distinct value from an array javascript distinct array items javascript get distinct from 2 arrays js to check distinct values in array identify distinct values javascript how to get distinct values from the database in js How to get distinct object from an array in JavaScript How to get distinct values from an array in JavaScript javascript array distinct array distinct number javascript find distinct values array create array with distinct length js make distinct array javascript how to get distinct value from array of object in javascript how to get distinct value from array of objectin javascript how to get distinct value from array of array in javascript check array to be distinct values javascript get distinct values from array javascript filter find js find distinct values in array distinct values array javascript with set javascript array distinct value array distinct value distinct array in javascript get distinct values from array of objects javascript distinct elements in array set in javascript to get distinct values from object array get distinct elements from array javascript javascript string array get distinct values array distinct javascript js count distinct entries in an array how to find distinct elements in an array get distinct name from array js get the objects that are unique array typescript extract distinct key from dictionary javascript javascript array unique object javascript count distinct values in array get all unique keys from array js show distinct value javascript javascript get unique objects from array javascript get distinct values from array of objects by 2 properties javascript get distinct values from array of objects js 2 array object get unique js array object get unique typescript using array map to get unique values sort out unique elements in array javas crupt map array of data and get unique values using javascript javascript array filter unique by property find unique element in array javascript using filter how to get unique array of array in javascript create unique elements from array javascript how to make array of objects unique in javascript javascript uniqe array js objects unique javascript object array get distinct values get unique values javascript array return unique values in array javascript key value list of unique objects javascript array with unique elements javascript js filter array of object based on unique attribute uniques values array javascript get unique object array list javascript javascript get unique items in array in array find unique elements in aray of object based on property distinct arrya of objects get only uniqe form array object javascript uniq method using callback javascript unique values in array of objects unique javascript function javascript map return two values unique array javascropt how to get 4 unique values from array of object in javascript how to find 4 unique item in array of object in javascript how fetch unique value in es6 sortout only unique in javascript arrays array uniq values isArrayUnique javascript get unique from array javascript sort array unique array map unique values only js find value in array only unique return unique array push unique values in array javascript immutable distinct ts string filter unique values in array rea Distinct objects by property value from an array of objects how to get unique values in array of objects in javascript javascript get distinct array values js unique array elements unique values in an object js distinct from array javascript unique function data.map unique values omnly unique list javascript javascript map array of objects unique javascript array of objects with unique property javascript filter unique objects key unique object values javascript code to get distinct string values from and array how to get unique objects from array in javascript get unique values while mapping over array javasc how to get distinct elements in array react js ceep aray unique value only get all unique values from array of objects javascript excluding undefined get list of distinct keys from list of objects js unique value of array with objects js unique array javascript map get only valye from key value current recors in javascript javacript uniq object in array js find unique properties of object array unique array map es6 js filter unique objects in array unique array of objects js for value unique of array js unique array of objects js javascript array make unique distinct javascript values array js objects array return unique return unique values js js unique objects in array array distinct array distinct of object javascript js get unique values unique value in array javascript uniq object js get unique from array javascript get unique from array of objects javascript filter an object to get unique values filter unique values in javascri[pt filter array to get unique values typescript how to make an object values uniq in javascript extract unique objects by attribute from array of objects. filter array of objects get unique values filter distinct values in typescript ts distinct array get unique values in array of objects javascript javascript find all unique values in array get distinct values from array in ts javascript get unique value javascript array unique id unique array based on key javascript js map unique values js filter array for unique values distinct value fomr array of object js array of object uniq angular uniq object by key in array find unique objects in an arrray array of only unique objects javascript get unique calues from array js get unique values from array of objects javascript distinct array object different values in array javascript return only unique strings from array javascript javascript filter object unique strings javascript filter object unique how to get distinct values in array js unique object in array js javascript get all unique values from array of objects filter uniqe object array how to get unique elements in a list in js javascript array map unique find the only unique value in array javascript return unique array js how to show the unique data from the map in javascript typescript unique array of objects javascript sort and unique array ~ JavaScript unique array js filter unique array javascript unique distributors map array with unique key get unique array javascript get unique js get all uniq properties of an array of object javascript select unique from list array to distinct javascript select unique values in an array of objects uniq array of onjects JS how to create array containing unique values in javascript typescript distinct by property js array keep unique values how to get unique numbers in js javascript get unique values from object array javascript get distinct value from array find unique number in an array js unique key in array javascript generate unique id for arr array of objects javascript find unique elements on array javascript unique objects array javascript return unique array of objects javascript js unique array numbers unique and filter function javascript get unique objectsin array javascript how to filter an array of objects for unique js pull unique objects from an array using array.prototype in js array prototype to store unique values get unique array from array unique element in an array of objects javascript javascript to unique array data map distinct javascript get unique objects from array of objects js array filter unique objects distinct objects by property value from an array of objects javascript distinct array distinct array into object javascript javascript filter distinct objects typescript unique array get unique values from array fater javascript js array distinct on property js get array unique key make unique array in javascript javascript get all unique values from object array array of unique elements how to make list with unique values in javascript unique values array js uniqe javascript select distinct records in javascript get uniques entries in array of object how to get unique array of objects in jvascript get unique objects from array of object find unique values from array of objects js how to contain unique value in array in js How to return only unique elements of an array in javascript js unique types distinct list of object properties javascript js make array of objects unique distinc value array of object distinct values of object property jquery check unique data from array js filter unique objects filter array of object on distinct values and get unique year object in array javascript distinct object array javascript get unique object in array javascript how to get unique elements of array javascript distinct in array javascript unique an array javascript javascript extract unique values from array of objects array unique typescript how to uniq array of objects react typescript stream distinct javascript find unique values in array of objects find only unique elements in an array javascript js filter array of objects by unique property add all unique values in array of objects javascript js get uniqe from string unique array js set set of unique arrays javascript only unique numbers javascript js distinct properties object js distinct keys object javascript array only add unique values unique values of array javascript javascript distinct values in array make unique items in array javascript get unique keys from array of objects javascript leave unique values in array js how to get array of object values based on unique property in using lodash how to get array of object values based on unique property in JS typescript distinct values from array javascript get array unique values from array get unique values from associative array javascript get unique values from associate array javascript filter array with unique objects javascript unique array javascript es6 Map filter objects by unique values of a field in an array of objects js filter by unique values of a field in an array of objects js make array unique js filter distinct column from array js javascript find unique uique all value array js TypeScript distinct array of objects by property typescript array distinct property typescript array distinc unqieu values array js javascript list unique map unique javascript get all unique values in array js javascript uniquify array how to get unique values from array in angular 6 get unique items in javascript array filter unique objects javascript .uniq= how to get distict array in js filter unique objects in array javascript return distinct in angular javascript get all different values javascript array unique by property distinct values in array javascript unique array of objects by property javascript get unique property values from array of objects with condition javascript get unique property values from array of objects get unique values from object array javascript array of objects unique javascript unique array objects javascript javascript unique object property values in array javascript unique object in array javascript unique object all properties return whole object javascript unique object all properties distinct array of objects javascript get all distinct values of an array in javascript js array get unique values typescript distinct array of objects unique values javascript get distinct values from array javascript distinct object in map javascript get unique data from javascript array object unique javascript set array object unique javascript get unique value from object based on key javascript javascript get distinct property values array.distinct javascript uniqu values in js filter unique values array javascript all numbers of array are unique javascript filter unique element in an array javascript js get distinct values from array push uniq data using map method in javascript unique values in array js distinct function javascript distrinct function javscript lodash unique values in array of objects javascript + filter array of objects + keep unique JS get disinct first object key in array JS return unique objects get unique objects from array of objects javascript JS how to get distinct object from array JS get distinct values from array and return object map unique ids to a list javascript JS select unique objects from property distinct element from array of objects fetch distinct records in array of object acc to key should have a unique key in array of object in javascript check should have a unique key in array of object in javascript distinct from array of objects with same key get unique value of a field in array of objects javascript check when elements are distinct, js js distinct array of objects unique item in array javascript js unique array of objects how to extract only unique values from property in object javascript how to extract only unique values from array javascript js distinct an array pull uniques objects from two array js javascript filter array to get distinct values filter unique values from array javascript array objects + unique get all unique value in an array of objects js array objects unique js map field distinct js unique rows from object array unique list of values javascript js map array elements with new uniq array of distinct objects javascript unique array object javascript ditinct array using filter js get unique objects from array js array map distinct values make array unique javascript javascript distinct array of objects by property javascript find unique arrays in array javascript distinct list javascript filter unique objects how to return distinct values in array map function js best distinct array javascript javascript get distinct values from object unique javascript es6 get unique values from array of objects to array javascript map distinct value from object javascript map distinct javascript filter array of objects unique return unique name values from objects in array in javascript return unique values from objects in array in javascript javascript filter unique elements how to return unique array of of object in javascript how to return unique values from array in js typescript get unique row from object array unique array of objects javascript get array of unique values from array of objects angular 8 filter unique array of objects in lodash check if all objects in array is unique javascript javascript object distinct how to get unique values in js javascript array filter unique object property javascript filter unique unique results in a array of objects in typescript js array of objects unique array map distinct unique element in array javascript get unique values from array of objects javascript unique in javascript select distinct elements javascript set array filter example unique value typescript get unique values from array of objects array unique in javascript javascript make sure object value is unique how to add only unique elemts from an array depending on object key how to get unique values from array of objects javascript get unique value from array of object js how to get unique values in an object node javascript array int unique javascript get unique array of objects javascript method that checks for distinct unique objects in array javascript unique array js get unique values from array javascript get unique values array javascript unique value in js distinct entries in javascript unique array map find unique string in array javascript filter unique values in javascript array how to get unique elements from array in javascript filter unique values from array of objects javascript filter unique values from array of objects get distinct values from list of objects typescript javascript apply unique value filter from the list get only unique values javascript javascript get unique values from array of objects unique value with map in javascript javascript unique array of objects map only unique values javascript js map object to new object unique only js map to new object uniue only how to iterate through object and check if unique values get unique values from object valuesjavascript javascript distinct object array get unique object values javascript filter distinct object value js filter distinct value js javascript array of objects unique object property javascript unique objects in array get distinct array javascript map return array with distinc values find unique elements in array using ecmascript get unique values from array make javascript array unique how to get distinct values in javascript array find unique items in array javascript distinct javascript javascript get unique objects in an array javascript distinct array js unique array number distinct values in array javascript distinct in javascript set unique values on array javascript javascript make sure array is unique typescript array distinct array unique elements javascript javascript select distinct from array unique values in array javascript typescript distinct array unique filter in javascript javascript unique set array values unique javascript array unique array items in javascript typescript distinct set javascript check unique values array javascript convert array to unique values show only unique values in array javascript find unique array javascript find uniuein array js array unique values distinct array in js distinct string in array javascript find unique value in array object javascript es5 find unique value in array javascript es5 uniqueness in javascript get specific unique values from array javascript uniq filter uniq javascript array what is a unique value in javascript what is a unique values in javascript distinct values in an array javascript array only unique values get distinct values from an array javascript array unoique js array uniue in javascript js get unique from array js distinct array how to get unique array by id in javascript javascript array unique js unique in array js array unique js unique javascript distinct array of objects filter unique values javascript javascript map distinct to array how to get unique values in list in javascript check array have unique value get unique objects in array javascript get unique values in array javascript javascript return unique elements of array javascript unique array get unique values from array nodejs how to get unique array from array js distinct in js make a copy of uniques js javascript unique array of objects by value get unique values js array new set unique array array unique js keep arrya of object unique javscrip[t array with the unique values js javascript store unique array how to get distinct values from an array of objects in javascript js make arr unique filter unique values in array javascript map javascript and fetch unique values check uniqueness js distinct elements in js javascript set no unique array distinct array javascript javascript select unique from array maintain a unique list javascript javascript unique values of array how to get unique elements in array js display unique values from array javascript how to get unique values of array in javascript array of unique elements javascript javascript get unique ints from array unique array javascript unique item in array javascript find unique values in array javascript array distinct values unique in array javascript get unique set js javascript array distinct string filter unique values of array check for unique values in array javascript js unique members of array javascript array get distinct values javascript array get unique values get only unique values from array javascript find unique elements in array javascript javascript unique array elements array select distinct unique elements in array javascript get unique values from array javascript of objects how to unique js array unique javascript javascript Array() distinct get unique values from map in javascript distinct() js find unique value in array js js is unique js unique array unique array javascript js filter unique get unique elements from array javascript typescript array of unique items javascript unigue javascript return distinct values in array getting unique values from array of objects getting distincted values from array only javascript make array unique js array distinct how to find the unique values in js js make array unique javascript unique list get unique items from array javascript javascript get distinct values from array
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source