The entries() method will return an iterator with a key (number) and a value. The order is zero-indexed (meaning it starts at 0) with the key showing the numbered order.

const head = document.querySelector("h1");
const classes = head.classList;

const iterator = classes.entries();

for (const value of iterator) {
  console.log(`(${value})`);
}
//The output would be all the entries in the console, but if you want to put it in an HTML element you can use the textContent property