title: Read multiple input lines using javascript
body: <p>I'm trying to do some algorithmic problems using Node's library of read lines : readline. (Actually, It was proposed by the course).</p>
  
  <p>The input code was : </p>
  
  <pre><code>var readline = require('readline');
  var lineNumber = 0;
  
  process.stdin.setEncoding('utf8');
  var rl = readline.createInterface({
    input: process.stdin,
    terminal: false
  });
  
  rl.on('line', readLine);
  
  function readLine (line) {
      // Do some work here.
  }
  </code></pre>
  
  <p>The problem is to calculate the sum of n numbers. As input we have : 
   1. In the first line, the number of numbers for which we want to calculate the sum.
   2. The second line will contain the "n" numbers seperated by spaces.</p>
  
  <p><strong>An example for an input would be : 
  5 
  1 4 8 7 9 
  The output in this case : 
  25</strong></p>
  
  <p>How can I do that with this library (I can do that with Java, C++, etc. But I don't know how to read multiple input lines using javascript)</p>