Working with an Angular application that adds 'ng-star-inserted' to each node element. My task is to determine if the target element's class exists within an array.
https://i.sstatic.net/v8G97k6o.png
var footerElementClassList = [
'footer-links__link',
'social__link-icon',
'bottom__link',
];
const filtered = footerElementClassList.includes('bottom__link ng-star-inserted');
console.log(filtered);
Attempted the following options without success
Option 1
var footerElementClassList = [
'footer-links__link',
'social__link-icon',
'bottom__link',
];
var mySet = new Set(footerElementClassList);
var hasB = mySet.has('footer-links__link ng-star-inserted');
console.log(hasB); //false
Option 2
var footerElementClassList = [
'footer-links__link',
'social__link-icon',
'bottom__link',
];
function hasMatch(value) {
return value = 'bottom__link ng-star-inserted';
}
const filtered = footerElementClassList.filter(hasMatch);
console.log(filtered); //false
Option 3
var footerElementClassList = [
'footer-links__link',
'social__link-icon',
'bottom__link',
];
console.log(footerElementClassList?.contains('footer-links__link ng-star-inserted'));
Option 4
var footerElementClassList = [
'footer-links__link',
'social__link-icon',
'bottom__link',
];
const filtered = footerElementClassList.includes('bottom__link ng-star-inserted');
console.log(filtered);