document.getElementById('myButton').onclick = function() {
this.classList.toggle('active');
}
/* var or const followed by its name */.getElementById(/* HTML element ID */);
/* var or const's name */.classList.toggle(/* Name of CSS class */);
// I hope this helps!
element.classList.toggle('class');
document.getElementById('myButton').onclick = function() {
var className = ' ' + myButton.className + ' ';
if ( ~className.indexOf(' active ') ) {
this.className = className.replace(' active ', ' ');
} else {
this.className += ' active';
}
}