This question already has an answer here:
C# uses string interpolation
int value = 100;
Console.WriteLine($"The size is {value}.");
Output:
The size is 100.
How to make same method in typescript?
Nitzan Tomer
In JavaScript you can use template literals:
let value = 100;
console.log(`The size is ${ value }`);
Ygalbel
Just use special `
var lyrics = 'Never gonna give you up';
var html = `<div>${lyrics}</div>`;
You can see more examples here.
来源:https://stackoverflow.com/questions/45399951/how-to-make-string-interpolation-in-typescript