Looping through an array when some elements are blank?
<p>I have a multidimensional array of answers, there can be 2, 3 or 4 answers.</p>

<pre><code>answers[0]{'Answer A', 'Answer B', 'Answer C', 'Answer D'}
answers[1]{'Answer A', 'Answer B'}
answers[2]{'Answer A', 'Answer B', 'Answer C'}
</code></pre>

<p>I want to loop through each one and if the answer exists show the answer, if the answer doesnt exist then I want to show a blank box.</p>

<pre><code>for (var i = 0, len = 4; i &lt; len; i++) {

    alert(answers[n][i]);               

}
</code></pre>

<p>How can I check in the above loop if the answer exists in the array and then act upon it?</p>
