Is there a syntax for inserting multiple array positions in a javascript function?

document.getElementsByTagName(“h1”)[0].style.fontSize = “6vw”;
Here, I want to add more array positions like [0,1] in this line of code which will say that apply this font size to both the ‘h1’ elements having array positions ‘0’ and ‘1’ in the document. I’m finding myself unable to put more than 1 array position in this javascript function. Can anyone help me with this problem?

getElementsByTagName returns an HTMLCollection which can be iterated with a loop.

How to Loop Through an HTMLCollection

1 Like

You can use a for…of loop

Edit: ah snap

2 Likes