title: How to add more then 1 operation per ternary case for jQuery .append($("<option/>", {...})?
body: <p>I'm adding multiple <code>option</code> elements to a <code>select</code> element using jQuery. Based on the value of <code>data</code> the text of an option and whether or not it's disabled is different. The order of adding the option elements to the select element should be chronological since they are delivery options.</p>
  
  <p>Ideally I'd like to add <code>if-else</code> statements but that's not working. The conditional ternary operator does work but it only seems to work for a single operation per case.</p>
  
  <p>Example:</p>
  
  <p>The default value for a specific option is '8/1 tussen 14:00-15:00 | €4.95'
  If <code>data.response</code> is smaller then 0 then it should be '8/1 tussen 14:00-15:00 | Vol' and the option should be disabled. Else it should return the enabled default value for that option.</p>
  
  <p>Here's what I'm currently trying:</p>
  
  <pre><code>$.each(timeSlotsObj, function(key, value) {
    var option_date = value.split(" ")[0].replace('/', '-'),
        option_slot = value.split(" ")[2];
  
    $.get("http://&lt;REDACTED&gt;/availability/" + selected_retailer_id + "/" + option_date + "/" + option_slot, function(data) {
      delivery_time_element.append($("&lt;option/&gt;", {
          value: key,
          text: data.response &lt; 1 ? (
            new_value = value.split(' ')
            new_value[4] = 'Vol'
            new_value.join(' ')
          ) : value,
          disabled: data.response &lt; 1 ? true : false
      }));
    });
  });
  </code></pre>
  
  <p>But this returns a <code>Uncaught SyntaxError: Unexpected identifier</code> for:</p>
  
  <pre><code>new_value[4] = 'Vol'
  </code></pre>
  
  <p>What else could I try?</p>