how to remove last new line in textarea code example
Example: javascript remove final newline from string
// Remove the trailing newline(s) from a string
str.replace(/\n*$/, "");
// Remove the trailing newline(s) from a string
str.replace(/\n*$/, "");