FrontendDeveloper.in

JavaScript question detail

How do you define multiline strings

You can define multiline string literals using the '\n' character followed by line terminator('').

var str = "This is a \n very lengthy \n sentence!";
console.log(str);

But if you have a space after the '\n' character, there will be indentation inconsistencies.

Back to all JavaScript questions
Get LinkedIn Premium at Rs 399