title: How to remove new line from user console input
body: <p>How can I remove new line from the user input in Node.js?</p>
  
  <p>The code:</p>
  
  <pre class="lang-javascript prettyprint-override"><code>var net = require("net");
  
  var clientData = null;
  
  var server = net.createServer(function(client) {
      client.on("connect", function() {
          client.write("Enter something: ");
      });
      client.on("data", function(data) {
          var clientData = data;
          if (clientData != null) {
              client.write("You entered " + "'" + clientData + "'" + ". Some more text.");
          }
      });
  });
  
  server.listen(4444);
  </code></pre>
  
  <p>Let's say I type "Test" in the console, then the following is returned:</p>
  
  <pre><code>You entered 'Test
  '. Some more text.
  </code></pre>
  
  <p>I would like such an output to appear in the single line. How can I do this?</p>