Adding createElements - text and Value without the necessary forLoop to the Array.
Tried map, forEach, but memory wise...it is still lagging with numerous entries.
Please help.
templateList example: ["a", "b", "c", "d", "e", "f"];
var templateList = new Array();
var selection = document.getElementsByName("name")[0];
for(var i = 0; i < templateList.length; i++) {
var open = document.createElement("Option");
open.text = templateList[i];
open.value = templateList[i];
selection.add(open);
}
templateListalready contain values? Given yourtemplateListarray, the code may be able to be shortened toconst selection = document.querySelector(".name"); templateList.forEach((value) => selection.add(new Option(value, value)));. SeeOption.