To select a group of elements, we
target either their tag
names or their class names.
getElementsByTagName
will select all
the HTML elements which match the
provided tag name.
The method returns an array-like list
of elements. So, we can access a specific
element using the bracket notation, []
. But,
none of the array methods will work though.
In the example given above, we get the
list of p
elements, and then we loop
over them to apply changes to each one
of them.
If you want to use the array methods,
you can convert the list
to an array using the Array.from()
method.