how to distinct in javascript by id code example Example: javascript get unique values from key const unique = [...new Set(array.map(item => item.age))];