今日有個 task 其中一個地方要在 Array of Json object 中
Distinct 一個 property
const data = [ { id: 1, category: 'fruit', name: 'Apple', }, { id: 2, category: 'fruit', name: 'Banana', }, { id: 3, category: 'herb', name: 'Basil', }, { id: 4, category: 'herb', name: 'Rosemary', }, { id: 5, category: 'fruit', name: 'Dragon Fruit', }, ]; 解決方法: (ES5)