title: Parser: How to Turn a JavaScript String into One Line of JavaScript?
body: <p>I'm trying to make a parser for formatting JavaScript in a contextual format. First I want to be able to convert the input JavaScript into one line of JavaScript and then format the code based on my requirements.  This does not remove all of the enters or white space:</p>
  
  <pre><code>txt = $.trim(txt);
  txt = txt.replace("\n", "");
  </code></pre>
  
  <p>How can I convert the text into one line?</p>