I am working with an array
const obj=[{fullCart: 5, halfCart: 4, smu: 3, stowage: 5, index: "FC-093"},
{fullCart: 5, halfCart: 4, smu: 8, stowage: 5, index: "FC-093"},
{fullCart: 5, halfCart: 4, smu: 0, stowage: 5, index: "FC-093"},
{fullCart: 5, halfCart: 5, smu: 3, stowage: 5, index: "FC-093"},
{fullCart: 5, halfCart: 7, smu: 3, stowage: 5, index: "FC-093"/}
]
In my code, I need to keep the last object in the array which has the same property 'index' as the previous one. In this case, objects with index 'FC-093' should be removed, resulting in:
[{fullCart: 5, halfCart: 7, smu: 3, stowage: 5, index: "FC-093/"}]