console.log( breakIntoParagraphs( "Lorem Ipsum\n\n\n\nDollar sit\n\nBacon yum." ) ); function breakIntoParagraphs( input ) { return input // This split will include the line delimiters in the result. .split( /(\r\n?|\n)+/ ) // Filter-out the line delimiters (which are nothing but white space). .filter( ( segment ) => { return segment.trim(); } ) ; }