title: why doesn't substring function return the newline character(\n)
body: <p>I was trying to find if the first 2 characters of a string contain the newline character using the substring, but for some reason I was the expected result.</p>
  
  <pre><code>var xyz= '\n\nsomething';
  if(xyz.substring(0,2)=='\n'){
     alert('found');  //expected result
  }else{
     alert('not found');  //actual result
  }
  </code></pre>
  
  <p>But if I use a regex for this then I get the correct result.</p>
  
  <pre><code>var xyz= '\n\nsomething';
  if(xyz.substring(0,2).match(/\n/)){
     alert('found');  //actual result and this is correct
  }else{
     alert('not found');
  }
  </code></pre>
  
  <p>Why do I not get the results when I use the substring function?</p>