title: access last if-statement-condition result value
body: <pre><code>var check = someCheck();
  if (check){
    doOne(check);
  }else{
    doTwo();
  }
  </code></pre>
  
  <p>Can I be able to write the same code without defining check var? something like this below</p>
  
  <pre><code>if (someCheck()){
    doOne(&lt;magic-value-passed-which-is-result-of_someCheck()&gt;);
  }else{
    doTwo();
  }
  </code></pre>
  
  <p>Note that check could be a true, or any object or null or undefined, what all a function call could return.</p>
  
  <p>I am thinking of the following solution as</p>
  
  <pre><code>var condition;
  function setCondition(stmt){
    condition = stmt;
  }
  
  if ( setCondition(someCheck()) ){
    doOne(condition)
  }else{
    doTwo();
  }
  </code></pre>
  
  <p>still am not much happy with this one, as <code>setCondition</code> is a lengthy name, wanna write simple and less code. Can we teak <code>if</code> itself or similar like any idea where could we access last <code>if</code> checked value? is <code>if</code> a function here?</p>