Computer Science, asked by Aniket881, 11 months ago

How to create a line break with JavaScript?

Answers

Answered by honeygupta4
1

Hey mate!!

here's your answer...

  1. »In JavaScript ,to keep long concatenation output readable, JavaScript provides two ways to create line breaks within your string. The first is the newline character ( \n ). The newline character creates line breaks within the output of a string, be it simply text or JavaScript-generated HTML

2.) Add %0D%0A to any place you want to encode a line break on the URL.

%0D is a carriage return character

%0A is a line break character

This is the new line sequence on windows machines, though not the same on linux and macs, should work in both.

If you want a linebreak in actual javascript, use the \n escape sequence.

★★Hope it will be helpful for you★★

★please mark as Brainlist ヾ(❀╹◡╹)ノ゙★

Answered by saranyaammu3
2

Answer:

To create a line break in JavaScript, use “<br>”. With this, we can add more than one line break also. Let’s see it in the below example:

<html>

  <body>

     <script>

        <!--

           document.write("Hello World!");

           document.write("<br>");

           document.write("Demo<br><br>Text!");

         //-->

     </script>

  </body>

</html>

Explanation:

Similar questions