javascript line break
snippet in javascript

javascript line break

user2151

//in JavaScript, you can declare a line break (or new line)
//with the \n character.
var linebreak = '\n';

new line in js

user1880

document.write("\n");
//second method for html page
document.write("<br>");

new line javascript

user1345

console.log('Hello \n World');

replace line break with html line break js

user9752

let multilineString = `My
text\r1\r\n2\n3\n\r4
is
here`;

let htmlText = multilineString.replace(/(\r\n|\n\r|\r|\n)/g, '<br>');

console.log('Multiline string: ' + multilineString);
console.log('HTML text: ' + htmlText);

new line with javascript write

user2473

res.write("\n");