title: Javascript - only first parameter passed when using apply for resolve in promise
body: <p>I am trying to call the resolve function in a given promise with an array of parameters using the apply function in Javascript. However, only the first parameter is passed, and the rest are undefined.  Minimal example:</p>
  
  <pre><code>const p = function(){
  return new Promise(function(resolve,reject){
  resolve.apply(null,["a1","a2","a3"]);
  });
  };
  
  p().then(function(a1,a2,a3){
  console.log(a1);
  console.log(a2);
  console.log(a3);
  });
  </code></pre>
  
  <p>The above gives output:</p>
  
  <pre><code>a1
  undefined
  undefined
  </code></pre>
  
  <p>What am i missing in the above example?</p>