Javascript – Want to find the amount of unique and duplicate objects from an array and list them in a specific way
[ { "id":5, "name": "banana" }, { "id":5, "name": "banana" }, { "id":4, "name": "apple" }, { "id":1, "name": "strawberry" }, { "id":1, "name": "strawberry" } ] const arrayMap = new Map(Array.map(i => [i.id, {...i, amount: 0 }])); Only have…