JSFiddle - React, Tailwind, and code Playground
HTML
<textarea id="mytextarea">
asd
qwe
asd
zxc
tyu
hjk
</textarea>
JavaScript
var lines = $('#mytextarea').val().split(/\n/);
var texts = []
for (var i=0; i < lines.length; i++) {
// only push this line if it contains a non whitespace character.
if (/\S/.test(lines[i])) {
texts.push($.trim(lines[i]));
}
}
alert(JSON.stringify(texts));