title: javascript split("\n\r") add comma on empty line
body: <p>I have below code which import file. I split it with split("\n\r") code but now every empty line has comma. How to fix it.. See code below and out put picture. </p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;script src="http://code.jquery.com/jquery-1.10.2.js"&gt;&lt;/script&gt;
      &lt;/head&gt;
  
  &lt;body&gt;
  
  
          &lt;textarea id="textareaid" name="textareaid" class = "textdata" value="" rows="10" cols="100" placeholder="Enter Any Text!"&gt;&lt;/textarea&gt;
          &lt;br&gt;
          &lt;input id="filename"  class="btnsubmit"  type="file" accept="text/plain" onchange="PreviewText();"  /&gt;
  
  &lt;script type="text/javascript"&gt;
  
                function PreviewText() {
                  var file = document.getElementById("filename").files[0];
                      var reader = new FileReader();
                      reader.onload = function (e) {
                      var array = e.target.result.split("\n\r");
                      alert (array);
                      document.getElementById("textareaid").value = array;
                      };
                      reader.readAsText(file);
          };
  
  &lt;/script&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/UJwwq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UJwwq.png" alt="enter image description here"></a></p>