How to update tuples in Javascript?
<p>(Not sure if I am using the correct terminology, in Python that is called a tuple. Hope it makes sense.)</p>

<p>I would like to refactor the following method. The only difference is the <code>enddate/startdate</code> respectively, therefore there is no need to repeat the code.</p>

<pre><code>function datepicker_reload(source, isPast){
    if(isPast){
        $(source).find('.date_picker').datepicker({ 
            endDate: new Date(),
            format: $('#locale').text(), 
            weekStart:1, 
            calendarWeeks:'True',   
            autoclose: 'True', 
            todayHighlight: 'True' 
        });
    }
    else{
        $(source).find('.date_picker').datepicker({
            startDate: new Date(), 
            format: $('#locale').text(), 
            weekStart:1, 
            calendarWeeks:'True',   
            autoclose: 'True', 
            todayHighlight: 'True' 
        });
    }
}
</code></pre>

<p>I was wondering if I could put the common values as a tuple together:</p>

<pre><code>var options = { format: $('#locale').text(), 
            weekStart:1, 
            calendarWeeks:'True',   
            autoclose: 'True', 
            todayHighlight: 'True'  };
</code></pre>

<p>Then add the one additional keypair in there: (However this step seems to be completely off, how do i achieve it?)</p>

<pre><code>if(isPast)
   options += {endDate: new Date()}
else
   options += {startDate: new Date()}
</code></pre>

<p>and then pass the whole tuple to the function:</p>

<pre><code>$(source).find('.date_picker').datepicker(options);
</code></pre>

<p>is this possible?</p>
