title: javascript if condition check string with newline symbol i.e \n
body: <p>In my script I have a string with newline characters. Using newline (<code>\n</code>)character I parsed it to array.</p>
  
  <p>I struggling to compare in my if condition (<code>parsedarray[0]=='newline character'</code>). Please help me to compare the newline character in my if condition. I also tried to alert the <code>parsedarray[0]</code>. It alerts blank alert box.` I am unable to check the newline character in if statement. <strong>For instance,</strong> I have a single String with multiple newline , tabs consisting of 40 lines. In my script user enter a line number, string for that line number, after receiving  both information, I want to replace the newline with entered string in the line number. Here line number is an <strong>index</strong>. So that again I will construct a single string by joining the parsed string. Also my array size should not grow. or Reduce.??? And importantly I want to validate the given String with the available string, if both matches (other than newline) need to put alert message.</p>
  
  <pre><code> var strarray=doc.getElementbyid('mytextarea').value;
   var parsedarray=[];
   parsedarray=strarray.split('\\n');`
  </code></pre>