An array gets appended with undefined after `array.push`ing some strings to it. Is that normal?
<p>I'm having trouble with a JavaScript array adding an extra undefined object after pushing some strings to the array.</p>

<pre><code>$(function() {
    var formTagArr = [];
    $( "button", "#start-button" ).click(function() {
            $.getJSON('http://127.0.0.1:8000/some_url/', function(data) {
                formTagArr.push(buildForm(data));
                console.log(formTagArr);
                displayForm(formTagArr);
            });
    return false;
    });

    function buildForm(data) {
        for (var i = 0; i &lt; data.length; i++) {
            var html = "";
            var questionsTags = "&lt;fieldset&gt;&lt;p&gt;" + data[i].question + "&lt;/p&gt;";
            var answersTags = "";
            for (j = 0; j &lt; data[i].answers.length; j++) {
                answersTags += "&lt;input type='radio' name='" + data[i].qid + 
                    "' value='" + data[i].answers[j] + "' /" + "&gt;" + 
                     data[i].answers[j] + "\n";
            }
            html = questionsTags + answersTags + "&lt;/fieldset&gt;";
            formTagArr.push(html);
        }
    }

    function displayForm(arr) {
        if (arr.length === 0) {
            return false;
        }
        var info = arr.pop();
        $("#question-form").append(info[0]);
    }
}); 
</code></pre>

<p>/some_url/ returns this JSON:</p>

<p><code>[{"qid": 4, "question": "How many legs does a spider have?", "answers": ["4", "6", "8", "10"]}, {"qid": 2, "question": "When did Nigeria become a republic?", "answers": ["1960", "1961", "1962", "1963"]}, {"qid": 1, "question": "When did Nigeria gain independence?", "answers": ["1960", "1961", "1962", "1963"]}, {"qid": 3, "question": "How many days are in a leap year?", "answers": ["360", "362", "365", "366"]}]</code></p>

<p>and console.log(formTagArr); in the code above returns:</p>

<p><code>["&lt;fieldset&gt;&lt;p&gt;How many l...e='10' /&gt;10\n&lt;/fieldset&gt;", "&lt;fieldset&gt;&lt;p&gt;When did N...963' /&gt;1963\n&lt;/fieldset&gt;", "&lt;fieldset&gt;&lt;p&gt;When did N...963' /&gt;1963\n&lt;/fieldset&gt;", "&lt;fieldset&gt;&lt;p&gt;How many d...'366' /&gt;366\n&lt;/fieldset&gt;", undefined]</code></p>

<p>Because of this, displayForm() fails since info is undefined. Of course I could just use a conditional to skip the undefined object but I want to know exactly how the undefined object got there in the first place.<br>
What did i do wrong?</p>
