How to remove second class of html element in javascript?

Viewed 362

I have multiple span tags. example:

<span class="name one"></span>
<span class="name two"></span>
<span class="name three"></span>
<span class="name four"></span>

how can i remove second class without using class name like span.classList.remove('three'); i just need something like span.classList.remove(1); to remove only second class from all span elements

1 Answers

I found answer

span.classList.remove(span.classList.item(1));
Related