Answers for "js template string"

1

js template string

// string literals ('') and ("").
const greeting1 = "Hello";
console.log(greeting1 + " World!");

// template string (``).
const greeting2 = "Hey";
console.log(`${greeting2} World!`);

// the cool thing about string literals is that you can write expressions inside them.
const num1 = 10;
const num2 = 34;

// ${num1 + num2} or any other calculation work well with template literals
console.log(`the result of ${num1} + ${num2} = ${num1 + num2}.`);
Posted by: Guest on September-06-2021
5

string literal javascript

`string text`

`string text line 1
 string text line 2`

`string text ${expression} string text`

tag`string text ${expression} string text`
Posted by: Guest on March-19-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language