title: Javascript short circuit if statement: How to return true
body: <p>I am trying to make a function which check the value if <code>null</code> or <code>""</code></p>
  
  <p>Here is what I got so far (that is working)</p>
  
  <pre><code>function notnull(values,success,failed){
  var count = 0
  
  $.each(values,function(index,val){
      console.log(val)
      val != "" &amp;&amp; val != null ? count++ : count 
  })
  if(count == values.length){
      return true;
  }else{
      console.log('false')
  }
  }
  </code></pre>
  
  <p>However If I tried short circuiting the 2nd <code>if</code> statement it returns an error</p>
  
  <pre><code>function notnull(values,success,failed){
  var count = 0
  
  $.each(values,function(index,val){
      val != "" &amp;&amp; val != null ? count++ : count
  })(count == values.length) ? return true:console.log('false')
  }
  </code></pre>
  
  <p>the error says</p>
  
  <blockquote>
    <p>Uncaught SyntaxError: Unexpected token return</p>
  </blockquote>
  
  <p>Question 1: How can I return <code>true</code> or <code>false</code> in a short circuit version</p>
  
  <p>Question 2: at the code</p>
  
  <pre><code>val != "" &amp;&amp; val != null ? count++ : count
  </code></pre>
  
  <p>How can I omit the else part?</p>