title: Can pass a conditional statement as a function argument?
body: <p>I have a main function and want to control 2 actions with it. Thereby I pass different variables to the function.</p>
  <p>My question is <strong>whether I can also pack the condition of an If query into a variable</strong>.</p>
  <p>For the one action I want to have <code>CurrentImageNumber &lt;= 3</code> as an if argument and for the other action <code>CurrentImageNumber &gt;= 2</code> in the if query.</p>
  <p>The code would look something like this:</p>
  <pre><code>function imageChange() {
      CurrentImageNumber = parseInt(CurrentImageID.slice(-1)) // not a static value
      if (b) {
          // Some fancy Code where var a is used  
      }
      else {        
          // Some fancy Code where var c is used
      }
  }
  
  document.getElementById('button-1').onclick = function() {
      imageChange(a = 1, b = CurrentImageNumber &lt;= 3, c = -3)    
  }
  
  document.getElementById('button-2').onclick = function() {
      imageChange(a = -1, b = CurrentImageNumber &gt;= 2, c = 2)    
  }
  </code></pre>