title: JavaScript find missing number in array
body: <p>I have this array</p>
  
  <pre><code>var a = [5] , count  = 5;
  </code></pre>
  
  <p>I want to know the missing numbers on this array (a) and the result must be </p>
  
  <blockquote>
    <p>1,2,3,4</p>
  </blockquote>
  
  <p>I just try this but failed</p>
  
  <pre><code>var missing = [];
  
  for ( var j = 0; j &lt; a.length; j++ ) {
      for ( var i = 1; i &lt;= count; i++ ) {
          if (a[j] != i) {
              missing.push( i );
          }
      }      
  }
  </code></pre>
  
  <p>i called it at once its give </p>
  
  <blockquote>
    <p>1,2,3,4</p>
  </blockquote>
  
  <p>add some value to (a) array like </p>
  
  <pre><code>a = [2,3,4,5] 
  </code></pre>
  
  <p>its give me this </p>
  
  <blockquote>
    <p>[1, 3, 4, 5, 1, 2, 4, 5, 1, 2, 3, 5, 1, 2, 3, 4]</p>
  </blockquote>
  
  <p>how can i solve it find the missing numbers to the count value</p>
  
  <blockquote>
    <p>note* find the missing numbers to the count value</p>
  </blockquote>