if (myElement.classList.contains('someClassname')) { // do something }
element.classList.contains(className);Code language: CSS (css)