how to assign a new class to a element in javascript code example Example: javascript give class to element element.classList.add("div-class");