const element = document.querySelector("#box");
element.classList.contains("active");
var isMobileVersion = document.getElementsByClassName('snake--mobile');
if (isMobileVersion.length > 0) {
// elements with class "snake--mobile" exist
}
const div = document.querySelector('.info');
div.classList.contains('secondary'); // trueCode language: JavaScript (javascript)
export const isClass = <T>(value: unknown): value is Constructor<T> => {
return typeof value === "function" && typeof value.prototype === "object";
};
export type Constructor<T> = new (...args: unknown[]) => T;
<div class="secondary info">Item</div>Code language: HTML, XML (xml)