working on getting the value from an array that has random numbers added to it to populate in a list. The math.random is working & the numbers are populating in the array. The function that adds them to the list is not. Tried using .attr to add a name to the array, didn't work, may have just been going about it the wrong way. I feel like the issue is somewhere in this: var newNum = document.getElementsByName(numList[0]).value, but after a lot of reworking this line I can't figure out what I'm missing/wording wrong. Any help is appreciated. Thanks!
<script>
    var numList = [];
    function myFunction() {
        var rnd = Math.floor(Math.random() * 10);
        document.getElementById('mathVal').value = rnd;
        numList.push(rnd);
        console.log(numList);
        buildList();
    }
    console.log(numList); //Working
    function buildList() {
        var newNum = document.getElementsByName(numList[0]),
            listNode = document.getElementById("newList"),
            liNode = document.createElement("LI"),
            txtNode = document.createTextNode(newNum);
        liNode.appendChild(txtNode);
        listNode.appendChild(liNode);
        console.log(newNum); //Not working, Getting undefined
    }
</script>
