What is the difference between .className(") and .classList.add(")?

Hello, dear experts! In the process of learning JS appeared a question:

.getElementById('id').className = 'class'
.getElementById('id').classList.add('class');

what are their differences (mean .className and .classList) ?

Thanks for the replies!
June 8th 19 at 16:42
1 answer
June 8th 19 at 16:44
Solution

Find more questions by tags JavaScript