In this article, we will discuss how to break javascript code into several lines. We generally break the code into several lines so that it can be read easily by a third person or the programmer itself.
There are a few ways to break JavaScript code into several lines:
- We can use the backslash \ character i.e “\”.
- We can use template literals.
We can use the addition operator.
Approach 1: Using Backslash \ character.
Javascript
// using \console.log("let us see how to break lines in javascript, \what can we do ?"); |
let us see how to break lines in javascript, what can we do ?
Approach 2: Using the + operator:
Javascript
// using addition operatorlet str = "This line is broken by " + "addition " + "operator"console.log(str); |
This line is broken by addition operator
Approach 3: Using the template literals.
Javascript
// using template literalslet str = ` This is a multiline string.`;console.log(str); |
This is a multiline
string.

… [Trackback]
[…] Find More here to that Topic: geeksforgeeks.org/how-to-break-javascript-code-into-several-lines-2/ […]
… [Trackback]
[…] Read More on on that Topic: geeksforgeeks.org/how-to-break-javascript-code-into-several-lines-2/ […]
… [Trackback]
[…] There you will find 81776 more Info on that Topic: geeksforgeeks.org/how-to-break-javascript-code-into-several-lines-2/ […]