toPrimitiveintermediateconst tag = {
[Symbol.toPrimitive](hint: string) {
return hint === 'string' ? 'Hello' : 0
}
}
`${tag}` // β 'Hello'Template literals trigger the 'string' hint, calling [Symbol.toPrimitive] with hint === 'string'.
Template literals trigger the 'string' hint when an object has [Symbol.toPrimitive].
Challenge: Verify that template literal coercion triggers the string hint.