how to remove trailing new line in js code example Example: Remove line breaks with JavaScript String.replace(/(\r\n|\n|\r)/gm," ")