Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
znzlcrstkk
Front End Web Development Techdegree Graduate 28,511 PointsHello, can somebody explain to me what means interpolation, and it's good to show some examples. Thank you!
Please give some examples about interpolation
2 Answers
Steven Parker
243,266 PointsInterpolation means "putting something into something else"
It's very similar to using braces ("{}") in a string and then replacing them with other things using the format function.
But in this case the language does it for you without using a function, the placeholders start with a dollar-sign, the braces contain the expressions to be substituted, and the whole thing is enclosed in back-ticks instead of quotes.
Here's an example
month = "July";
day = "Fourth";
console.log(`Happy ${day} of ${month}`);
znzlcrstkk
Front End Web Development Techdegree Graduate 28,511 PointsThank you