Preview:
 

/**
Checks whether a class exists in an element
*/
function getClass(element, className) {
    return element.className.indexOf(className) !== -1;
  }




//alterntively use
function getClass(element, className) {
    return compareDrawer.className.indexOf("myClass) > -1
  }


// modern use
function hasClass(element, className) {
    return element.classList.contains(className);
}
  
 // returns boolean on all three instances
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter