html
<h2 class="example example2">A heading with class="example"</h2>
javascritp code
var element = document.querySelectorAll(".example.example2");
element.style.backgroundColor = "green";
The querySelectorAll() method returns all elements in the document that matches a specified CSS selector(s), as a static NodeList object.
The NodeList object represents a collection of nodes. The nodes can be accessed by index numbers. The index starts at 0.
also learn more about https://www.w3schools.com/jsref/met_document_queryselectorall.asp
== Thank You ==