Verifique se existe uma classe JavaScript
const element = document.querySelector("#box");
element.classList.contains("active");
Xanthous Xenomorph
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)