Checks if an HTMLElement has a specific class attached.
.hasClass(className)true if the class is attached, false if it is not..contains() function and only provides a slightly more convenient way of referencing this property.Simple example:
let foo = document.getElementById('foo'); if (foo.hasClass('bar')) { … };