if getelementsbyclassname code example
Example: check if a class exists javascript
const element = document.querySelector("#box");
element.classList.contains("active");
const element = document.querySelector("#box");
element.classList.contains("active");