Here we have an element with two classes. We want to replace one of them and then display the result.
<span class="elementOne text"></span>
We can use the replace() method, so let's replace the class elementOne with elementTwo.
let spanElement = document.querySelector('.elementOne');
spanElement.classList.replace('elementOne', 'elementTwo');
console.log(spanElement.classList);
What will be printed on the console?