if classname in classlist js code example
Example 1: if classlist contains js
element.classList.contains(class);
Example 2: classList has class
if (document.body.classList.contains('thatClass')) {
// do some stuff
}
element.classList.contains(class);
if (document.body.classList.contains('thatClass')) {
// do some stuff
}