title: Creating better version of promise function
body: <p>Im a bit struggling to grasp promises, I have a use case when I perform X async actions, and when these are completed I make call to rest api. below my code: </p>
  
  <pre><code>const promises = defect.images.map(async image =&gt; {
        return new Promise((resolve)=&gt; {
          this.fileProvider.getDefectImage(image.url)
            .then(binary =&gt; {
              images.set(image.url, binary);
              resolve();
            });
        })
      });
      console.log(images)
      return Promise.all(promises)
        .then(() =&gt; spinner.dismiss())
  </code></pre>
  
  <p>but the console.log of images is always empty ... what should i change? </p>
  
  <p>//edit
  sorry guys for leading into a trap, indeed this console.log can not work properly but Im not getting the data on bakcend side, its also empty there.</p>