title: How does this code pass an argument to a callback that takes no arguments?
body: <p>I'm sifting through some code and I don't get how this piece of code is able to pass arguments to a callback that takes no arguments.</p>
  <p>We start with this object:</p>
  <pre><code>const oracleEndpoints = {
    pancake: () =&gt; fetchPancake(),
    lps: () =&gt; fetchLP(endpoints.lps), &lt;-- endpoints.lps is an API url
  };
  </code></pre>
  <p>And this map:</p>
  <pre><code>const oracleToIds = new Map()
  oracleToIds.set(&quot;lps&quot;, [&quot;png-snob-avax&quot;, &quot;png-png-avax&quot;])
  oracleToIds.set(&quot;pancake&quot;, [&quot;WBNB&quot;, &quot;BREW&quot;])
  </code></pre>
  <p>Now this is the part I don't get:</p>
  <pre><code>const promises = oracleToIds.keys().map(key =&gt; oracleEndpoints[key](oracleToIds.get(key)));
  </code></pre>
  <p><code>oracleEndpoints[key]</code> is an anonymous callback (<code>() =&gt; fetchPancake()</code> or <code>() =&gt; fetchLP(endpoints.lps)</code>) and <code>oracleToIds.get(key)</code> is an array of strings.</p>
  <p>What's going on in this expression <code>oracleEndpoints[key](oracleToIds.get(key))</code> then where an unparametised callback is passed an array?</p>
  <p>How is it able to do this?</p>