JSFiddle - React, Tailwind, and code Playground

HTML

<div id="list">
    <ul id="listUL">
        
    </ul>
</div>

JavaScript

subjects = ["test","test2"];
array = [{x:"test",name:"name"},{x:"test2",name:"name2"}];

for (i=0; i< subjects.length; i++) {
    var li = document.createElement("li");
    var a = document.createElement("a");
    a.setAttribute("href","javascript:change("+array[i].x+")");
    a.innerHTML = array[i].name;
    li.appendChild(a);
    document.getElementById('listUL').appendChild(li);
}