title: Javascript / Jquery custom event based on state of multiple variables
body: <p>I have multiple variables in javascript( say for example aValue, bValue, cValue). All these variables are initially set to 0. Now I have multiple functions / events which change these values as per my custom logic. When all these three variable values become 1, I want a new event to be triggered by which I can alter the DOM.</p>
  
  <pre><code>var aValue = 0;
  var bValue = 0;
  var cValue = 0;
  
  // On doing something functionA is called
  functionA() {
    aValue = 1;
  }
  
  //On triggering some event function is called
  $(selector).on(event, function() {
    bValue = 1;
  });
  
  //On doing something functionC is called
  functionC() {
   cValue = 1;
  }
  </code></pre>
  
  <p>I need to trigger an event when all these functions are invoked (thereby changing all the variables to 1). By using this event I want to change the DOM. </p>
  
  <p>Something like </p>
  
  <pre><code>$(selector).on(// when aValue == 1 &amp;&amp; bValue == 1 &amp;&amp; cValue == 1, function(){
    // do something
  });
  </code></pre>
  
  <p>Is there a way to do it. </p>