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?
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?
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>`;
Pay attention this is NOT an apostrophe, nor a quote.
Most probably you're on a QWERTY keyboard, so you'll find it JUST below the Esc key in the top left corner:
In case you're using a special keyboard, you can check this exhaustive list to find the backtick.
const value = 100;
console.log(`The size is ${value}.`);
(Valid in both JavaScript and TypeScript)