What happens when you try to use a variable in a template literal that is not defined?
When you try to use a variable in a template literal that is not defined, JavaScript throws a ReferenceError. This happens because the expressions inside ${} are evaluated as regular JavaScript code. In JavaScript, attempting to access an undeclared variable results in a ReferenceError, and this behavior applies equally within template literals. This error-checking behavior is actually beneficial as it helps catch typos or references to undefined variables earlier in the development process, rather than silently producing unexpected output like 'undefined' or an empty string.