JavaScript Code


How to create multiline string in JavaScript?


Create Multiline String

to create a multiline string literal in JavaScript, enclose your string value in back tick characters

in the following example, we have a multiline string literal defined using back ticks

`this is
a multiline
string`

Example

in the following script, we define a multiline string, and print it to console output

let message = `Hi Raj!
Welcome to this new world.
We are happy to have you here.`;
console.log(message);