JSFiddle - React, Tailwind, and code Playground

HTML

<div class="class1"></div>
<div class="class2"></div>

CSS

.class1 {
   background-image : url("http://images.visitcanberra.com.au/images/canberra_hero_image.jpg");
  height:20px;
     border:1px solid #000;
}
.class2 {
 height:20px;
    border:1px solid #000;
}

JavaScript

$(function(){
   arr = ["class1", "class2"];
    arrBgExists=[];
    $(arr).each(function(i,ele){
      
        var exists=$('.'+ele).css('background-image');
        console.log(exists)
        if(exists!='none'){
            arrBgExists.push(ele);
        }
      
    });

console.log('these elements are having background'+arrBgExists);    
})