JavaScript Add String Newline Character : Sometimes we need to add the newline character using JavaScript. It is very easy to add newline character using JavaScript.Here in this tutorial we are going to explain how you can add the newline charcter using JavaScript. You can use our online editor to try and edit the code online.
JavaScript Add String Newline Character Example
You add break line in JavaScript as below –
JavaScript Add String Newline Character Example:
<a href="#">Print Array Using Break Line</a> Output = <p id="output"> </p> |
br tag is used to add the break line between the array elements. The above function will add breakline in after each element of array. It adds the br tag after the array element & appends it to the paragraph with id “output”. It will print array elements line wise. On the same way you can add the break line anywhere you need.
If you run the above example it will produce the output something like this –