What's the difference between using className and classList.add()?
const div = document.createElement('div');
div.className = 'highlight';
div.classList.add('active');
className and classList.add() serve different purposes. className replaces all existing classes with the new value, while classList.add() adds a new class while preserving existing ones. In this code, after both operations, the div will have both 'highlight' and 'active' classes. If we had used className = 'active' instead of classList.add('active'), it would have removed the 'highlight' class. classList also provides other useful methods like remove(), toggle(), and contains().