Predict Template Literal
Predict Output Easy
Question
What does this code print?
Code
const name = "Ada";
const age = 36;
console.log(`${name} is ${age} years old`);
Hint
Template literals interpolate ${} expressions into the string.
Explanation
Template literals (backticks) interpolate ${expression} into the string. ${name} becomes Ada and ${age} becomes 36. The result is "Ada is 36 years old". Template literals are cleaner than concatenation for combining strings and variables.
Related Resources
Related Lessons
- JavaScript Functions
Learn about template literals.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.