Imagine having a dataset structured like this:
var items = [
{
category: 'shoes',
},
{
category: 'hat',
},
{
category: 'scarf'
},
{
category: 'shoes'
}
]
I am in search of a method to locate
(find item) and transform
(edit item on-the-fly) the item with a matching category
of shoes
where the node before it has a category
that equals scarf
. Essentially, only the last item in the array should be targeted.
Is there a JavaScript solution for achieving this task? Are there any libraries that offer this specific functionality?