multi line string in javascript code example
Example 1: Multi-Line JavaScript
console.log(`i am a multiline
string
and it works
but not on all browsers
- yet
`);
Example 2: javascript multiline string
const multilineString = `This
is
a
multiline
string
in
javascript`;
Example 3: html how to type a long string in many lines
function getLongString() {
return `
Bacon ipsum dolor amet boudin pastrami shankle ham fatback
pork. Short ribs ham beef, filet mignon ball tip sirloin
shankle t-bone drumstick. Ground round drumstick pancetta
fatback alcatra.
`;
}
function getDynamicMessage() {
const personName = "Dave Dude";
const whatever = (((1 + 2) * 3) / 4);
return `
Hello, ${personName}! Here's a very long string with
some dynamic values in, such as: ${whatever}`;
}
Example 4: javascript string in multiple lines
var html = `
<div>
<span>Some HTML here</span>
</div>
`;
Example 5: javascript multiline string
var MultilineString = `This
is
a multiline
string`;
var MultilineString = 'This \n\
is \n\
a multiline \n\
string';