title: String comparison fails
body: <p>I have built a simple TCP server and need to compare client input with hard-coded string stored in variable.</p>
  
  <p>However, the <code>data == username</code> always fails.</p>
  
  <p>Why? What can I do about it?</p>
  
  <p>The example:</p>
  
  <pre><code>var authenticateClient = function(client) {
      client.write("Enter your username:");
      var username = "eleeist";
      client.on("data", function(data) {
          if (data == username) {
              client.write("username success");
          } else {
              client.write("username failure");
          }
      });
  }
  
  var net = require("net");
  var server = net.createServer(function(client) {
      console.log("Server has started.");
      client.on("connect", function() {
          console.log("Client has connected.");
          client.write("Hello!");
          authenticateClient(client);
      });
      client.on("end", function() {
          console.log("Client has disconnected.");
      });
  }).listen(8124);
  </code></pre>