How to Perform String Interpolation in Typescript?
C# Uses String Interpolation Int Value = 100; Console. Writeline($"The Size Is {Value}."); Output: the Size Is 100. How to Do the Same Thing in Typescript? 7 2...
C# uses string interpolation
int value = 100;
Console.WriteLine($"The size is {value}.");
Output:
The size is 100.
How to do the same thing in TypeScript?
2 Answers
In JavaScript you can use template literals:
Template literals are literals delimited with backticks (`)
let value = 100;
console.log(`The size is ${ value }`);
Just use special `
var lyrics = 'Never gonna give you up';
var html = `<div>${lyrics}</div>`;
You can see more examples here.