title: conditionally deconstruct object (javascript)
body: <p>I want to check an argument, if it was undefined (or false), I will assign a value to it by deconstructing an object</p>
  
  <pre><code>function test(x){
    let obj={x:1,y:2}
    if(!x){x}=obj;
  }
  </code></pre>
  
  <p><strong><em>note:</em></strong>
  I don't want to use a temporary variable</p>
  
  <pre><code>if(!x){
    let {temp}=obj;
    x=temp
  }
  </code></pre>