Imagine having 4 labels and 4 buttons aligned next to each other. While it's common to update the label values by their corresponding button IDs, is there an alternative method using objects or references?
<button onclick="myFunction()">Set demo1</button>
<button onclick="myFunction()">Set demo2</button>
<button onclick="myFunction()">Set demo3</button>
<p id="demo1"></p>
<p id="demo2"></p>
<p id="demo3"></p>