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