Show duplicate index for duplicate values in an array of objects in javascript
We have an array of objects with keys productid and productname. productnames are duplicate but productid is unique. Assign same productid to all duplicate products in this array of objects in javascript expected input: const products = [ { productId:…