How to Check if a Class Exists

var test = document.getElementsByClassName('test');
console.log(test.length);
var test = $$('.test');
console.log(test.length);