Loops and array

Loops and array

Im just starting to learn jquery and having a bit of trouble with loops. I am trying  to create a variable array that contains certain product names, if the product name in the array matches the heading inner text, then add a class to the product image. I have come up with the below which works fine when there is only one individual product in the variable, but if i add more than one product to the variable, it breaks. Can anyone tell me where I'm going wrong?

Code looks like this so far:

var product =  ["Product1", "Product2"];
var image = jQuery('.pushed').children('img');
var heading = document.getElementsByClassName('t-entry-title h6');
    
    jQuery(heading).each(function () {

        if (jQuery(this).text() == product){
            jQuery(this).parent().parent().parent().prev().find("img").addClass("product_class");
        }
    });

Any help appreciated