Promise.all invoking array variable full of functions : <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>function getMyFunction(data) {
    return () =&gt; new Promise((resolve, reject) =&gt; {
        resolve('here is the value:' + data);
    });
}
const whatToGet = [
    'a',
    'b',
    'c',
    'd',
    'e',
];
const stuffArray = whatToGet.map(thing =&gt; getMyFunction(thing));
Promise.all(stuffArray).then((result) =&gt; {
    console.log('result: ', result);
});</code></pre>
</div>
</div>
</p>

<p>I am expecting </p>

<pre><code>result: [
    'here is the value: a',
    'here is the value: b',
    'here is the value: c',
    'here is the value: d',
    'here is the value: e'
]
</code></pre>

<p>but I instead get result:</p>

<pre><code>result:  [ () =&gt; new Promise((resolve, reject) =&gt; {
        resolve('here is the value:', data);
    }), () =&gt; new Promise((resolve, reject) =&gt; {
        resolve('here is the value:', data);
    }), () =&gt; new Promise((resolve, reject) =&gt; {
        resolve('here is the value:', data);
    }), () =&gt; new Promise((resolve, reject) =&gt; {
        resolve('here is the value:', data);
    }), () =&gt; new Promise((resolve, reject) =&gt; {
        resolve('here is the value:', data);
    })
]
</code></pre>
