I have an object array like this:
var objectArray = [{id_5:"100"},
{id_1:"300"},
{id_2:"500"},
{id_4:"700"},
{id_3:"200"}];
And a normal array like this:
var normalArray = ["id_2","id_5","id_4"];
I want to subtract every element from the objectArray if there's a matching ID in the normalArray. I then want to order the newly created array by the object's value (lowest value being first).
So for the above example the result would be:
var newObjectArray = [{id_3:"200"},
{id_1:"300"}];
Is it possible to do this without jQuery?
I've seen similar questions like this one: Removing object from one array if present in another array based on value but I haven't been able to find an answer that works. Is it possible to do a compare and remove like this while still keeping the key:value pairs intact? Thanks in advance for any help with this!