es6 add class with index code example
Example 1: es6 add and remove class
let el = document.getElementById('container');
//remove class
el.classList.remove('first');
//remove class
el.classList.add('first');
Example 2: javascript add class to element
var someElement= document.getElementById("myElement");
someElement.className += " newclass";//add "newclass" to element (space in front is important)