title: get value from result of conditioned loop with array
body: <p>how to get the value of the loop that is not the value of the array [0, 2, 3,4], I put this array in the &quot;Bulan&quot; variable.</p>
  <p>let's say I have the result value of the loop 0 - 11 (0,1,2,3,4,5,6,7,8,9,10,11) and I want to get the value (1,5,6,7,8 ,9,10,11)</p>
  <pre><code>const d = new Date();
  const monthNames = [&quot;January&quot;, &quot;February&quot;, &quot;March&quot;, &quot;April&quot;, &quot;May&quot;, &quot;June&quot;, &quot;July&quot;, &quot;August&quot;, &quot;September&quot;, &quot;October&quot;, &quot;November&quot;, &quot;December&quot;];
  var dataWaktu = [];
  var dataIzin = [];
  var dataCuti = [];
  var dataSakit = [];
  
  var Bulan = []; //[0,2,3,4]
  var dataLeave = [];
  
  for (var i = 0; i &lt; monthNames.length; i++) {
      var existData = true; 
      $.each(data, function(index, val) {
          if(val.Bulan == monthNames[i] ){ 
              // console.log(i);
              Bulan.push(val.Bulan);
              existData = true; return; 
          } else {
              // console.log(i);
              existData = false;  
          }
      });
      
      if(existData){
          $.each(data, function(index, val) {
              dataLeave.push({ Bulan: val.Bulan, Cuti: val.Cuti, Izin: val.Izin, Sakit: val.Sakit });
          });
      } else {
          //output : 1 5 6 7 8 9 10 11
          // dataLeave.push({ Bulan:monthNames[i], Cuti: 0, Izin: 0, Sakit:0 });
          console.log(i); //0 1 2 3 5 6 7 8 9 10 11
      }
  };
  </code></pre>