JSFiddle - React, Tailwind, and code Playground
HTML
<div id="elem1" class="red purple yellow white"></div>
<div id="elem2" class="black white"></div>
JavaScript
function matchesSomeSelectors(element, selectors) {
return selectors.some(function (selector) {
return Prototype.Selector.match(element, selector);
});
}
var selectors = ['.green', '.red', '.yellow']
console.log(matchesSomeSelectors(document.getElementById("elem1"), selectors))
console.log(matchesSomeSelectors(document.getElementById("elem2"), selectors))