hoisting anonymous function expression which is an array item
<p>This code needs to declare a function (preferably anonymous) inside the array<br>
<code>({argObj}) =&gt; {console.log(</code>start<code>);}</code>
and define it later outside the <code>request = (function() {...}());</code> IIF.</p>

<pre><code>request = (function () {
  const pathAfter = {
    start: ['homePage', 'GET', ({argObj}) =&gt; {console.log(`start`);}]
  };
  return {

    go: (argObj) =&gt; {
      if(!pathAfter[argObj.pathAfter]) return;

      const path = pathAfter[argObj.pathAfter][0];
      const method = pathAfter[argObj.pathAfter][1];
      const url = data.domain + path + data.ext;

      HTTP.call(method, url, (error, response) =&gt; {
        if (error) {
          console.log('error '+error);
        } else {
          pathAfter[path][2]({response: response}); // &lt;---- calls relevant method

          request.go({pathAfter: path});
        }
      });
      return true; // if rms seccessful
    }
  };

}());

// function definition goes here...
</code></pre>

<p>I am not sure how to do this. Thanks</p>