

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to new line string - JavaScript?
Use <br> tag for a new line.
Example
Following is the code −
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> <script src="https://code.jquery.com/jquery-1.12.4.js"></script> <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> <body> <h1 id="headingDemo"> My Name is David Miller </h1> </body> <script> document.getElementById("headingDemo").innerHTML = "My Favourite Subject is JavaScript" + '<br>' + "I live in AUS."; </script> </html>
To run the above program, save the file name anyName.html (index.html). Right click on the file and select the option “Open with Live Server” in VS Code editor.
The output is as follows −
- Related Questions & Answers
- How to provide new line in JavaScript alert box?
- How to print new line in Java?
- Find a new line character with JavaScript RegExp.
- In JavaScript, can be use a new line in console.log?
- How to Line Breaks to JavaScript Alert?
- Print new line and tab in Arduino
- Add line break inside a string conditionally in JavaScript
- How to return a new string with a specified number of copies of an existing string with JavaScript?
- Inserting new line to the output using WS_Download in ABAP
- Remove new line characters from rows in MySQL?
- Search text containing a new line in MySQL?
- How to match anything except space and new line using Python regular expression?
- How to create JavaScript objects using new operator?
- How to create a line break with JavaScript?
- Does JavaScript have a method to replace part of a string without creating a new string?
Advertisements