I am assigning an element to array but it shows undefined
<pre><code>    var prev = [];
    var count = 0;
    var data = '';
    $('#add_ref').click(function(){
       var man_val = $.trim($('#manual_ref').val());
         if(($.inArray(man_val,prev))==-1){

          if(man_val != ''){
            count += 1;
            prev[1] = man_val;
            alert(prev[i);// Problem is here
            data = '&lt;li id="45" class="as-selection-item"&gt;&lt;a class="as-close"&gt;x&lt;/a&gt; '+ man_val +'   &lt;input id="notal_45" class="cls-notal" type="checkbox" value="45" name="notal_chk[]"&gt;&lt;/li&gt;';
            $('#ul-rtl-ref-1').append(data);
        }
       }
  }
 );
</code></pre>

<p>Why it doesn't assigning value to array ?
if I write <code>prev[1] = "myvalue"</code> its also not working. Alert always shows undefined
<strong>Edit</strong> prev.push(man_val) shows push is not a function </p>
