Q:

Print an array from user input in JavaScript

I am trying to create an array from user input in JavaScript and display the latest array as the numbers are appended to the array. The numbers are not getting printed.
Kindly help.
HTML part :
<textarea form = "arrays" cols = 10 rows = 2 id = "num">
    </textarea><br />

<form id = "arrays" method = "" onsubmit="arrAppend(document.getElementById('num').value);">
<input type ="submit" value="Append" />
</form>

JavaScript part :
<script>

    var myarr = [];
    function arrAppend(num) {
        myarr.push(+num);
        text = "";
        for (var x = 0; x< myarr.length; x++) {
            text += myarr[x];
        }
        console.log(text);
    }

</script>

A:

This is working :
HTML : 
<input type = "text"
   id = "addNumber" />

<input type = "button"
   id = "addToArray"
   value = "Append"
   onclick = "arrAppend();" />

JavaScript :
function arrAppend() {
        myarr[x] = document.getElementById('addNumber').value;
        alert("Element : "+myarr[x]+" is added at index "+x);
        x++;

        document.getElementById('addNumber').value = "";

