jquery classlist has class code example
Example 1: jquery hasclass
if ($( "#foo" ).hasClass('className')) {
$( "#foo" ).removeClass( 'className');
} else {
$( "#foo" ).addClass( 'className');
}
Example 2: javascript hasclass
if (document.body.classList.contains('thatClass')) {
// do some stuff
}