Javascript – Convert an array of object into 2-dimensional array to group the elements with same id in typescript
I have an array of object as arr1 = [{catid: 1, name: 'mango', category: 'fruit'}, {catid: 2 name: 'potato', category: 'veg'}, {catid: 3, name: 'chiken', category: 'nonveg'},{catid: 1, name: 'apple', category: 'fruit'}, {catid: 1, name: 'banana', category: 'fruit'}]; I want…