title: Dynamically access object function within module exports
body: <p>I have a function module.exports as shown below</p>
  <pre><code>const eventHandler = {
    login: () =&gt; {
      console.log(`login main -&gt; event handler called....!`);
    },
    execute: (prop) =&gt; {
      console.log(`event name ${prop}....!`);
      eventHandler.login();
    },
  };
  
  module.exports = eventHandler;
  </code></pre>
  <p>here i don't want to use switch case in order to call different functions based on prop.</p>
  <p>So, I'm looking for something like below to dynamically call a function</p>
  <pre><code>eventHandler[`${prop}`];
  </code></pre>
  <p>The above one is not working. It's just an idea of what I needed.</p>
  <p>How to avoid switch case and achieve above thing ?</p>