How to create a line break with JavaScript?


To create a line break in JavaScript, use "<br>". With this, we can add more than one line break also.

Example

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>

Updated on: 06-Sep-2023

37K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements