title: Promise.all() - How to resolve() without returning undefined or value
body: <p>I want to use <code>Promise.all()</code> to check if a value is in an array. My problem is when the value is not found in the array, the promise returns <code>undefined</code>, but I would like to only have the values that was found in my array.</p>
  
  <pre><code>var array = [1,5,10];
  var values = [1,2,3,4,5,6,7,8,9,10];
  var foundValues = [];
  
  values.forEach(function(value) {
      foundValues.push(isInArray(array, value));
  });
  
  Promise.all(foundValues).then(function(values) {
      console.log(values) // [1, undefined, undefined, undefined, 5, undefined, undefined, undefined, undefined, 10 ]
  });
  
  function isInArray(array, value) {
      return new Promise(function(resolve, reject) {
          if (array.indexOf(value) &gt; -1) {
              resolve(value); //here the value is returned
          } else {
              resolve(); //here undefined is returned
          }
      });
  };
  </code></pre>
  
  <p><strong>Edit:</strong> The question is not really about finding a value in an array, I just choose this simple example to illustrate my question.</p>