javascript remove last line break 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*$/, "");