The output of this program will be:
After clicking the button, the output of the code will be:
Best Laptops under 40,000
For example, it can be done by escaping every newline on each line. There is one more method in which the user can concatenate two strings together as a final string. In ES5 which is the old browser, the creation of multi-string is now possible. The user can execute it by adding a backslash at the end of each line in the code. This will define the multi-line string.
<script> var str = '<div class="content">' + '<h1>Welcome to Developer Helps</h1>' + '<p>Please scroll down for details</p>' + '</div>'; document.write(str); </script>
The output of the program will be:
In the above code, the user can use ‘+’ operator for the concatenation of two strings. It can be used after each line in the code as a format of ES5. However the user doesn’t has to perform any of this in ES6 version. The use of document.write in the code is to print the final string after concatenation of the two strings.