javascript split long string into lines in javascript code Edit

Murugan Andezuthu Dharmaratnam | 08 September 2020 | 2055

While coding in javascript, in the code you might have a very long string which you would like to break it into multiple lines for better code readability.

Program Statement

console.log('if this is a really long text I would like to 
display this in multiple lines' );
                    

above javascript code, I have I am trying to break the line into two lines. If I try to run the above code I get the error message

Uncaught SyntaxError: Invalid or unexpected token

Solution 1

solution is to escape the line with a "\" character 

Solution 2

another solution is to break the line with a plus