The teacher works on the class’s real menu card: add, remove, toggle, replace and contains run on the element, the board writes its tokens and class…
Toggling classes is the main way JS changes how things look: open a menu, the active tab, a dark theme. classList makes it safe (no duplicates, no lost spaces) and short: toggle('open', isOpen) replaces an if/else.
classList is a list of tokens, className is just a string
className string by hand (className += ' aktif') Easy to forget the space (classes glue together) or duplicate. Use classList.add/remove, which work per token.if (x) add() else remove() pattern Replace it with one line: classList.toggle('open', x). The second argument forces it to match the condition, so it is safe to call again.style for every change of look Keep the look in CSS classes; JS only adds and removes them. Tidier, easy to theme, and the transitions still come from CSS.add('shadow') twice The attribute still holds one shadow: add never duplicates.add('shadow big') The browser refuses with InvalidCharacterError: a token may not contain a space. Write 'shadow', 'big'.toggle('open', isOpen) and change isOpen The second argument forces: true always adds, false always removes.'open', then press += With no space, open sticks to the last token: see the new token on the board.