var stringWithLineBreaks = ` O boy I've got Breaks `; var stringWithoutLineBreaks = stringWithLineBreaks.replace(/(\r\n|\n|\r)/gm, "");//remove those line breaks
st = st.replaceAll("\\s+","")
a.replaceAll("\\s+","");
//Removing whitespace from String var str = " Hello World! "; console.log(str.trim());
// Remove the trailing newline(s) from a string str.replace(/\n*$/, "");