In this example, we check if the browser supports the classList.contains() method. If not, the regular expression works as a fallback to achieve the same result (for older browsers).
Click the button to find out if the DIV element has a "mystyle" class.