title: Removing the new line character from javascript and making the data come in single line
body: <p>I've the data like</p>
  
  <p>1</p>
  
  <p>2</p>
  
  <p>3</p>
  
  <p>4</p>
  
  <p>after I replace I should get the data as <code>1234</code> or <code>1 2 3 4</code>.</p>
  
  <p>I'm reading the content from one field and storing it one variable.
  I'm assigning the replaced value to one more variable.</p>
  
  <p>I've tried using</p>
  
  <pre><code>var justiread=comments.read();
  var result=justiread.replace(new RegExp( "/\r?\n|\r/", "g" ), "");
  </code></pre>
  
  <p>even after replacing I'm getting the same as I've entered.</p>
  
  <p>If i want to do the same thing repeatedly
  say like 7 times. I'm using for loop but the same query is not working.
  any help pls</p>
  
  <pre><code>  for(h=1;h&lt;=7;h++){
      var addjusti=JUSTIFICATION.read(h);
      var addresult=addjusti.replace(/(\r\n|\n|\r)/gm," ");
  
      }
  </code></pre>
  
  <p>but i'm unable to write it into the field</p>
  
  <p>Anyone please help me out.</p>