document.getElementById("MyElement").classList.add('MyClass');
document.getElementById("MyElement").classList.remove('MyClass');
if ( document.getElementById("MyElement").classList.contains('MyClass') )
{
document.getElementById("MyElement").classList.toggle('MyClass');
}
//Overwrite all classes
element.className = "class";
//Add class
element.classList.add("class");
let containsClass = element.classList.contains('my-class');
element.classList.toggle('my-class', !containsClass);