# Template strings in JavaScript

There is a special type of quotes - backticks:

`let str = `abc`; alert(str); // shows 'abc'`

With backticks you can perform insertion of variables. To do this, you need to write the variable name in the construction `${}`.

Let's look at an example. Let's say we want to add strings and a variable:

`let str = 'xxx'; let txt = 'aaa ' + str + ' bbb';`

This code can be rewritten like this:

`let str = 'xxx'; let txt = `aaa ${str} bbb`;`

Rewrite the following code, using variable insertion:

`let str1 = 'xxx'; let str2 = 'yyy'; let txt = 'aaa ' + str1 + ' bbb ' + str2 + ' ccc';`
←→
↑
en ru