Template literals dùng backtick thay dấu nháy, hỗ trợ: interpolation ${expression}, multi-line strings, tagged templates.
Tagged templates là function nhận template strings và expressions làm arguments.
javascript
// Interpolation + multi-line:
const msg = `Hello ${name},
Welcome!`;
// Tagged template (styled-components pattern):
function css(strings, ...values) {
return strings.reduce((acc, str, i) => acc + str + (values[i] ?? ''), '');
}
const color = 'blue';
const style = css`color: ${color}; font-size: 16px;`;