this.classList.toggle('opened') code example
Example 1: add multiple class list at once in js
elem.classList.add("first");
elem.classList.add("second");
elem.classList.add("third");
is equal to :
elem.classList.add("first","second","third");
Example 2: toggle css class in javascript
/* 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!