JavaString declared string array returning undefined

my code is rather simple so I am surprised that I cannot find the error:

...
<div id="TreeBoxes" style="float:right;"></div>
...
<script type="text/javascript">
    var trees = new Array("Ambroňe","Borovice","Břízy",...,"Zmarličníky");
    var trees_sz = trees.length();
    for(count = 0; count < trees_sz; count++) {
        var txt = document.createTextNode(trees[count]);
        document.getElementById("TreeBoxes").appendChild(txt);
    }
</script>

The code just creates a bunch of text saying “undefined” instead of the contents of the trees variable.
The full code is running on this site: http://www.stromytrebonska.cz/mapa/

Read more here: JavaString declared string array returning undefined

Leave a Reply

Your email address will not be published. Required fields are marked *