Vanilla Javascript Check for Class on Element

Sometimes, devs can rely on jquery a little> too much, and forget how to check for a className without a framework to help. Granted
$(elem).hasClass("className");
is easy. But sometimes, one must go jquery free!
el.classList.contains(className);
However, the .contains is not supported by all browsers
So, you can always fallback to good oleindexOf
function hasClass(el, className) {
    return (' ' + el.className + ' ').indexOf(' ' + className+ ' ') > -1;
}