Answers for "javascript get unique items in array of array"

15

javascript get unique values from array

const myArray = [1,2,3,1,5,8,1,2,9,4];
const unique = [...new Set(myArray)]; // [1, 2, 3, 5, 8, 9, 4]

const myString = ["a","b","c","a","d","b"];
const uniqueString = [...new Set(myString)]; //["a", "b", "c", "d"]
Posted by: Guest on July-25-2020
3

javascript get unique values from key

const unique = [...new Set(array.map(item => item.age))];
Posted by: Guest on June-05-2020

Code answers related to "javascript get unique items in array of array"

Code answers related to "Javascript"

Browse Popular Code Answers by Language