Answers for "how to pick the unique key from array of object javascript"

3

javascript get unique values from key

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

javascript find unique values in array of objects

var flags = [], output = [], l = array.length, i;
for( i=0; i<l; i++) {
    if( flags[array[i].age]) continue;
    flags[array[i].age] = true;
    output.push(array[i].age);
}
Posted by: Guest on January-07-2021

Code answers related to "how to pick the unique key from array of object javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language