title: How to capture the arrow keys in node.js
body: <p>What is the utf8 code for all four arrow keys (up down left right)?</p>
  
  <p>I am learning node.js and I am trying to detect whenever these keys are being pressed.</p>
  
  <p>Here is what I did, but none of it capturing the arrow keys... I am a complete newbie to node.js so I might be doing something hilariously stupid here.</p>
  
  <pre><code>var stdin = process.stdin;
  stdin.setRawMode(true);
  stdin.resume();
  stdin.setEncoding('utf8');
  
  stdin.on('data', function(key){
      if (key === '39') {
          process.stdout.write('right'); 
      }
      if (key === 39) {
          process.stdout.write('right'); 
      }
      if (key == '39') {
              process.stdout.write('right'); 
      }
      if (key == 39) {
          process.stdout.write('right'); 
      }
  
      if (key == '\u0003') { process.exit(); }    // ctrl-c
  });
  </code></pre>
  
  <p>Thanks.</p>