When accessing an object repeatedly, it is much more efficient to store it in a local variable in order to use it over and over again. For example, the following code makes a local copy of the grouped DOM values instead of accessing each value separately:
function myJS(){ let group = document.getElementById("grouped"); group.property1 = "value1"; group.property2 = "value2"; group.property3 = "value3"; group.property4 = "value4"; // Instead of: // // document.getElementById("grouped").property1 = "value1"; // document.getElementById("grouped").property2 = "value2"; // document.getElementById("grouped").property3 = "value3"; // document.getElementById("grouped").property4 = "value4"; }
Doing so will allow you to avoid the ...