The values()
property return the iterator that as all the values from the selected token list. If theres no specific value in tha parameter it’ll list all of the values in a token. For example if you use the method on a classList
it’ll name all of the classes values, but if you tell it the specific one using it’s zero-index positon it will only return that class. You can also make it’s property have brackets for arrays.
const head = document.querySelector("h1");
const classes = head.classList;
const item = classes.values();
for (let value of item) {
head.textContent += `${value}`;
}