check class exist or not in dom using javascript code example
Example 1: js check for class in classList
element.classList.contains(className);
Example 2: check if a class exists javascript
const element = document.querySelector("#box");
element.classList.contains("active");