Advertisement
728x90
You can define multiline string literals using the '\n' character followed by line terminator('\').
javascript
1var str = "This is a \n very lengthy \n sentence!";
2
3console.log(str);But if you have a space after the '\n' character, there will be indentation inconsistencies.
Advertisement
Responsive Ad
🎯 Practice NowRelated Challenge
JavaScript Coding Exercise 55
Test your knowledge with this interactive coding challenge.
Start CodingAdvertisement
728x90
139of476