classList.contains(classes.) code example
Example 1: js check for class in classList
element.classList.contains(className);
Example 2: classlist
// use the classList API to remove and add classes
div.classList.remove("foo");
div.classList.add("anotherclass");