டெம்ப்ளேட் லிட்டரல்கள் (Template Literals)
டெம்ப்ளேட் லிட்டரல்கள் (Template literals) என்பவை பேக்டிக் (``) உடன் பிரிக்கப்பட்ட லிட்டரல்கள் மற்றும் சரங்களில் (strings) மாறி மற்றும் கோவை இடைக்கணிப்பில் பயன்படுத்தப்படுகின்றன.
let text = `Hello World!`;
// template literals with both single and double code inside a single string
let text = `He's often called "Johnny"`;
// template literals with multiline strings
let text =
`The quick
brown fox
jumps over
the lazy dog`;
// template literals with variable interpolation
const firstName = "John";
const lastName = "Doe";
const welcomeText = `Welcome ${firstName}, ${lastName}!`;
// template literals with expression interpolation
const price = 10;
const VAT = 0.25;
const total = `Total: ${(price * (1 + VAT)).toFixed(2)}`;