how to exclude blank values in jquery array?
<p>there are following input fields with datepicker class: </p>

<pre><code>&lt;input type="text" class="datepicker" value="" /&gt;
&lt;input type="text" class="datepicker" value="" /&gt;
&lt;input type="text" class="datepicker" value="2011-02-15" /&gt;
&lt;input type="text" class="datepicker" value="2011-02-16" /&gt;
</code></pre>

<p>I need to create an array of dates, exclude blank values and return maximum value. Following code doesn't seem to exclude blank values:</p>

<pre><code>var datelist = [];
$(".datepicker").each(function(i) {
    if (this.value!="") {datelist[i] = this.value;}
});
datelist.sort();
datelist.reverse();
alert(datelist); //,,2011-02-16,2011-02-15
alert(datelist[0]); //undefined
</code></pre>

<p>What's the catch?</p>
