You need to start reading the documentation for the functions that you're calling. If you don't understand what the return values of these methods are then you'll constantly need to ask for support.
Document.querySelectorAll() - Web APIs | MDN[
^]
Document.getElementsByTagName() - Web APIs | MDN[
^]
Unlike your
previous question[
^] these functions return a collection of values, which means there could be more than one result. You can't call
.innerHTML
on a collection, you need to iterate over them:
const matches = document.querySelectAll('h1');
for (let i = 0; i < matches.length; i++) {
matches[i].innerHTML = 'I am a header #' + i;
}