I have the following JavaScript that contains two objects with an id and an attribute.
How can I check if a specific combination (id + attr tupel) from A is included in B? so is currentHMLMap[i] included anywhere in the whole newHTMLMap object?
    deleteLinks.on('click', function(ev){
        ev.preventDefault();
        var currentHTML = $('.product');
        var currentId = $("body").find('.product').toArray().map(function(e){return $(e).attr("data-id-product");});    
        var currentAtr = $("body").find('.product').toArray().map(function(e){return $(e).attr("data-id-product-attribute");}); 
        currentHTMLMap = currentId.map(function(x, i) {
            return{"id": x, "atr" : currentAtr[i]} 
        }.bind(this));
        var newHTML ;
        var deleteIndices = [];
            $.ajax({
            url: this.href,
            type: "GET",
            dataType: "html",
              success: function(data) {
                  newHTMLId = $(data).find('.product').toArray().map(function(e){ return $(e).attr("data-id-product");})
                  newHTMLAtr = $(data).find('.product').toArray().map(function(e){ return $(e).attr("data-id-product-attribute");})     
                 //creating "map"
                 newHTMLMap = newHTMLId.map(function(x, i) {
                     return{"id": x, "atr" : newHTMLAtr[i]} 
                 }.bind(this));
                  for(i = 0; i  < currentHTML.length; i++){
// is currentHMLMap[i] included in newHTMLMap?
                      if (??){
                    deleteIndices.push(i);
                      }
                  }
                     for(i = 0; i < deleteIndices.length; i++) {
                    console.log("removing index" + deleteIndices[i]);
                    currentHTML[deleteIndices[i]].remove();
    }
              }
        });
    });
Update:
currentHTMLMap:
0: {id: 1, atr: 5}
1: {id: 3, atr: 71}
newHTMLMap:
0: {id: 3, atr: 71}
It is possible, that newHTMLMap contains more than one entry and there may be more than one element removed.
So the first index of currentHTMLMap is not included in the newHTMLMap, so I want to push 0 to deleteIndices.
I hope this helps for clarification.
 
     
    