title: Is there any way to init BOTH key and value at the same time in javascript objects with ternary operator?
body: <p>for example, I want a javascript object having different key-value according to a==0:</p>
  
  <pre><code>var v=a==1?{
    "a":"1",
  }:{
    "b":"2",
  };
  </code></pre>
  
  <p>I want to simplify to something like:</p>
  
  <pre><code>var v={
    a==1?("a":"1"):("b":"2"),
  };
  </code></pre>
  
  <p>and hence for more conditions:</p>
  
  <pre><code>var v={
    a==1?("a":"1"):("b":"2"),
    c==1?("c":"3"):("d":"4"),
    .
    .
    .
    "commonKey1":"commonValue1",
    "commonKey2":"commonValue2"
  };
  </code></pre>
  
  <p>Which init both key and value using ternary operator, but I tried the syntax above and it is not working, is there any correct syntax to do this?</p>