records = [ { name: "Alpha", set: 5, weight: 185 }, { name: "Alpha", set: 5, weight: 350 }, { name: "Bravo", set: 5, weight: 185 }, { name: "Charlie", set: 5, weight: 185 }, { name: "Delta", set: 5, weight: 185 } ]
I have a JSON array of multiple records and I need to filter these records by name and weight. So for example, since there are two "Alpha" records, I need to only pull in the one with the highest weight (which would be the second record). I have no idea how to filter and rebuild this array with only the desired results.
I need to keep the original array intact as I'll be displaying ALL in a table, but I need to build a secondary array with only the objects with the greatest value, by name.