.classList.contains(class) code example
Example 1: js check for class in classList
element.classList.contains(className);
Example 2: class list contains class java
List<Card> hand = ...;
for(Card card : hand){
if (card instanceof AceOfDiamonds) return true;
}
Example 3: classlist.contain in javascript
let span = document.querySelector("span");
let classes = span.classList;
let result = classes.contains("d");
if (result) {
span.textContent = "The classList contains 'c'";
} else {
span.textContent = "The classList does not contain 'c'";
}