Creating an object from the string value of input field
<p>I have an input hidden field similar to :-</p>

<pre><code>&lt; input type="hidden" name="dateRange" id="dateRange" value="'2013-04-03','2013-04-04','2013-04-05','2013-04-10'"/&gt;
</code></pre>

<p>I need to create an object in javascript using this input field's value. like:-</p>

<pre><code>var dates_allowed = {
      '2013-04-03': 1,
      '2013-04-04': 1,
      '2013-04-05': 1,
      '2013-04-10': 1,
};
</code></pre>

<p>I tried with the following;</p>

<pre><code>var dateRange=document.getElementById("dateRange").value;
var dates_allowed_Array = dateRange.split(",");
var dates_allowed1 = {};
for (i=0; i&lt;dates_allowed_Array.length;i++) {
    var innerloop = dates_allowed_Array[i] ;
    dates_allowed[innerloop]=1;
    }
</code></pre>

<p>but it did not work.</p>
