JSFiddle - React, Tailwind, and code Playground

HTML

<textarea id='txtArea' rows="4" cols="50">
At w3schools.com 
you will learn how to make a website.
We offer free tutorials 
in all web development technologies.
</textarea>

JavaScript

$(function(){
    var text=$('#txtArea').text();
    //alert(text);
    var lines = text.match(/^.*((\r\n|\n|\r)|$)/gm);
    alert(lines[0]);
    alert(lines[1]);
    alert(lines[2]);
    alert(lines[3]);
});