js template string

Solutions on MaxInterview for js template string by the best coders in the world

showing results for - "js template string"
Richie
04 Jun 2017
1// string literals ('') and ("").
2const greeting1 = "Hello";
3console.log(greeting1 + " World!");
4
5// template string (``).
6const greeting2 = "Hey";
7console.log(`${greeting2} World!`);
8
9// the cool thing about string literals is that you can write expressions inside them.
10const num1 = 10;
11const num2 = 34;
12
13// ${num1 + num2} or any other calculation work well with template literals
14console.log(`the result of ${num1} + ${num2} = ${num1 + num2}.`);
Leni
21 Jun 2018
1`string text`
2
3`string text line 1
4 string text line 2`
5
6`string text ${expression} string text`
7
8tag`string text ${expression} string text`