title: convert textareas string value to JavaScript array separated by new lines
body: <p>I have a <code>textarea</code> where the user can write up to 1000 characters. I need to get the <code>jQuery('#textarea').val()</code> and create an array where each item is a line of the <code>textarea</code>'s value. That means:</p>
  
  <blockquote>
    <p>This is a nice line inside the textarea.<br>
    This is another line.<br>
    (let's asume this line is empty - it should be ignored).<br>
    Someone left more than 2 new lines above.</p>
  </blockquote>
  
  <p>Should be converted to a JavaScript array:</p>
  
  <pre><code>var texts = [];
  text[0] = 'This is a nice line inside the textarea.';
  text[1] = 'This is another line.';
  text[2] = 'Someone left more than 2 new lines above.';
  </code></pre>
  
  <p>That way they can be easily <a href="http://phpjs.org/functions/implode:430" rel="noreferrer">imploded</a> for to querystring (this is the qs format required by the provider):</p>
  
  <pre><code>example.com/process.php?q=["This is a nice line inside the textarea.","This is another line.","Someone left more than 2 new lines above."]
  </code></pre>
  
  <p>I tried both the <a href="http://phpjs.org/functions/explode:396" rel="noreferrer">phpjs <code>explode()</code></a> and <code>string.split("\n")</code> approaches but they doesn't take care of the extra new lines (aka line breakes). Any ideas?</p>