title: Find first missing number in a sequence of numbers
body: <p>I am trying to figure out how to find the first missing number of a sequence of numbers like this (1,2,3,5,6,9,10,15)</p>
  
  <p>I want to put the first missing number, #4, into an variable for later use but don't know how to do so?</p>
  
  <p>I have tried this but this only gives me the last number:</p>
  
  <pre><code>var mynumbers=new Array(1,2,3,6,9,10);
  for(var i = 1; i &lt; 32; i++) {
      if(mynumbers[i] - mynumbers[i-1] != 1) {
          alert("First missing number id: "+mynumbers[i]);
          break;
      }
  }
  </code></pre>
  
  <p>First of all it gives me the first number after an "hole" in the numbersequence, secondly it continues to alert all numbers comming after an "hole" if I don't insert an break. I only want the first missing number of an numbersequence from 1 - 32. How do i do so?</p>
  
  <p>Hoping for help and thanks in advance ;-)</p>