title: What's the best replacement for a char?
body: <p>I am porting over some Java code to JavaScript. I have a lot of member elements that are a <code>char</code>. Is it more efficient to make those a number or a string (where the string will always be a single character)?</p>
  
  <p><strong>Update:</strong>
  The way it's presently used in Java is I have:</p>
  
  <pre><code>/** alignment is left. */
  public static final char TAB_STOP_LEFT = 'l';
  
  /** alignment is center. */
  public static final char TAB_STOP_CENTER = 'c';
  
  /** alignment is right. */
  public static final char TAB_STOP_RIGHT = 'r';
  
  private char tabStop;
  </code></pre>
  
  <p>And then I have lots of places where I either assign one of the TAB_STOP_* values to tabStop or test the value of tabStop against specific values. There is no need for it to be l/c/r, I just used those to make it easier to read in the debugger (this code is from Java 1.3, long before enums).</p>
  
  <p>The cleanest way to do this is to make them enums and then tabStop is a number. However, if it's faster &amp; uses less memory if each is a 1 character string, I can do that instead.</p>
  
  <p><strong>Update 2:</strong>
  A big thank you to Juan Mendes &amp; JLRishe - really good detail. What I've decided to do is go with enums (ie numbers) because the difference between the two is minimal and enums make everything a lot clearer.</p>