document.querySelectorAll('.restab').forEach((n, i) => {
n.id = `responsivetable${++i}`;
});
// или
for (const [ i, n ] of document.querySelectorAll('.restab').entries()) {
n.attributes.id.value = 'responsivetable' + (i + 1);
}
// или
const elems = document.getElementsByClassName('restab');
for (let i = 0; i < elems.length; i++) {
elems[i].setAttribute('id', 'responsivetable'.concat(-~i));
}