xxxxxxxxxx
// Using \n to insert a new line
var message = "This is the first line.\nThis is the second line.";
// Logging the message to the console
console.log(message);
xxxxxxxxxx
document.write("\n");
//second method for html page
document.write("<br>");
xxxxxxxxxx
// To represent a new line character in JavaScript, you can use the escape sequence '\n'.
// Example 1: Print two lines of text
console.log("Line 1\nLine 2");
// Example 2: Create a multi-line string
const multiLineString = "This is line 1\nThis is line 2\nThis is line 3";
console.log(multiLineString);
xxxxxxxxxx
<script>
document.write("Have a nice day!");
document.write("<br>");
document.write("Thank You.");
//OR
document.write("Have a nice day! <br>Thank You.");
//OR
document.write("Have a nice day! <br>");
document.write("Thank You.");
//OR
document.writeln("Hello World!");
document.writeln("Have a nice day!");
</script>
xxxxxxxxxx
document.write("<br>"+ n1)// here n1 is variable and the value of n1 print in next line