title: Wait for user input from readline module (Node.Js)
body: <p>I am creating a module to get experience and shorten some code. I have a piece of code which uses readline in a simplified manner, like <code>var x = arkin.question("How old are you? ");</code>. Readline doesn't wait for the answer. It produces this:</p>
  
  <blockquote>
    <p>How old are you? undefined</p>
  </blockquote>
  
  <p>Code:</p>
  
  <pre><code>const readline = require('readline');
  
  const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
  });
  
  exports.question = function(q){
  
    var response;
  
    rl.setPrompt(q);
    rl.prompt();
    rl.on('line', (userInput) =&gt; {
      response = userInput;
      rl.close();
    });
  
    rl.on('close', () =&gt; {
      return response;
    });
  }
  </code></pre>
  
  <p>I call it like this:</p>
  
  <pre><code>var age = arkin.question("How old are you? ");
  console.log(age);
  </code></pre>
  
  <p>I have tried using this code:</p>
  
  <pre><code>rl.question(q, (userInput) =&gt; {
      rl.close;
      response = userInput;
      return response;
  });
  </code></pre>
  
  <p>Yet I get the same result. Thanks in advance for your help.</p>