1const data = [
2 { group: 'A', name: 'SD' },
3 { group: 'B', name: 'FI' },
4 { group: 'A', name: 'MM' },
5 { group: 'B', name: 'CO'}
6];
7const unique = [...new Set(data.map(item => item.group))]; // [ 'A', 'B']
1//ES6
2let array = [
3 { "name": "Joe", "age": 17 },
4 { "name": "Bob", "age": 17 },
5 { "name": "Carl", "age": 35 }
6];
7array.map(item => item.age)
8 .filter((value, index, self) => self.indexOf(value) === index)
9
10> [17, 35]
1const categories = ['General', 'Exotic', 'Extreme', 'Extreme', 'General' ,'Water', 'Extreme']
2.filter((value, index, categoryArray) => categoryArray.indexOf(value) === index);
3
4This will return an array that has the unique category names
5['General', 'Exotic', 'Extreme', 'Water']
6
7