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

JavaScript JavaScript Basics Working with Strings Write a Template Literal

Guys I read it all and keeps asking about interpolation but I did it! What is wrong?

app.js
const flavor = "Blueberry";
const type = "Smoothie";
const price = 4.99;
const drink = `${Blueberry} ${Smoothie}: $${4.99}`;
// This will render "Blueberry Smoothie: $4.99"

4 Answers

Hi Jennifer!

Nice catch!

Not sure how I got that happened.

I guess I go back and forth between JS and Python questions so much that I got crossed-up!?!

Odd, really, given that I have already answered that question several times before.

I'll do my best to make sure it doesn't happen again, though, for sure.

Stay safe and happy coding!

Try:

const drink = `${flavor} ${type}: $${price}`;

Thanks! I figured that, I mixed up the languages

Hi Olga!

You aren't using the variables you created in the drink string.

(In other words, still use flavor, type, and price - don't change those, just the rest of the syntax, which you appear to be using correctly, so kudos on that!)

:)

Like this:

const drink = `${flavor} ${type}: $${price}`;
// This will render "Blueberry Smoothie: $4.99"

You can test Python challenge code here:

https://www.katacoda.com/courses/python/playground

Just add something like this to the end of the code:

print(drink)

...to actually see the drink string print out.

I hope that helps.

Stay safe and happy coding!

Jennifer Nordell
seal-mask
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there, Peter Vann! I'd like to point out that you're combining languages here. The question was for JavaScript so the first part is correct, but the second part, I'm pretty sure you meant to do a console.log(drink); as opposed to a Python print(drink) and instead point to a testing space for JavaScript :smiley:

The first part will work in JavaScript but not Python and the second part will work in Python but not JavaScript.

Thanks a lot!

Thanks EVERYBODY! I figured that!!!! Just need one more try for the last module)