Строка интерполяция JavaScript
const age = 3
console.log(`I'm ${age} years old!`)
Drab Dogfish
const age = 3
console.log(`I'm ${age} years old!`)
`string text`
`string text line 1
string text line 2`
`string text ${expression} string text`
tag`string text ${expression} string text`
const apples = 4;
const bananas = 3;
console.log(`I have ${apples} apples`);
console.log(`I have ${apples + bananas} fruit`);
var name = "Taimoor";
var country = "Pakistan";
// string interpolation
console.log(`I am ${name} and I am from ${country}`);
const string = 'This is a string.';
const message = `${string} This is also a string.`;
const name = "John";
console.log(`Welcome ${name}.
You have ${2 * 5} new notifications!`);