new line in javascript string
// let's say you want to make a code output game in a web page // and you want to add a C# code // do it like this! const csCode = ` static double avrg(int num1, int num2, int num3){<br>   double rslt = (num1 + num2 + num3) / 3;<br>   return rslt;<br> }<br> int[] numbers = {10, 15, 8, 4, 2, 81, 90, 34, 23};<br> int num1 = numbers[3];<br> int num2 = numbers[7];<br> int num3 = numbers[2] * numbers[1];<br> Console.WriteLine(avrg(num1, num2, num3)); `; // and then display it with innerHTML; document.getElementById('code-display').innerHTML = csCode; // the ThickSpace; will make it look like a tab keypress // and now it will look good and will not generate on 1 single line // and this works for TypeScript as well
new line in js
document.write("\n"); //second method for html page document.write("<br>");
javascript text new line
\r\n
new line javascript
console.log('Hello \n World');
javascript new line
+"<br>"
Source: forum.freecodecamp.org
new line with javascript write
res.write("\n");