JSFiddle - React, Tailwind, and code Playground

HTML

<div>
<a href="#">link1</a>
<a href="#">link2</a>
<a href="#" class="class1">link3</a>
<a href="#">link4</a>
<a href="#" class="class2">link5</a>
<a href="#" class="class3">link6</a>
<a href="#">link7</a>
</div>

JavaScript

var excluded = ['class1','class2','class3'];
var excludedSelectors = excluded.map(function(className) {
	return '.' + className;
});

$('div a').not(excludedSelectors.join(',')).each(function () {
// здесь скроются все. А с классами указанными в масиве не нужно скрыть

	$(this).hide();
});