title: Javascript function inside functions
body: <p>Today I observed the following syntax (simplified example):</p>
  
  <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>const test = fn =&gt; () =&gt; console.log(fn) 
  test('foo')();</code></pre>
  </div>
  </div>
  </p>
  
  <p>Having a hard time wrapping my head around this but it still remains vague to me. What exactly happens step by step? </p>