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 trialTrevor Terry
720 PointsI need help. I feel like Im doing what the statement is asking but it's not right.
I'm not understanding this statement:
Make sure you're including : $
immediately after type
and before `price
const flavor = "Blueberry";
const type = "Smoothie";
const price = 4.99;
const drink = `${flavor} + ' ' + ${type} + ':$ ' + ${price}`;
2 Answers
ronnie nelson
Front End Web Development Techdegree Student 267 Pointsconst drink = ${flavor}${type}: $${price}
;
^
the answer.
you can't concatenate(add) template literals the same way you do strings.
Think of it like this the drink costs ${price}
would evaluate to "the drink costs 4.99" <- notice how there is no "$"?
that's because ${} is the syntax that contains your variable and it is sort of 'ignores' everything around it and only prints what's inside of it.
so $${price} would print $4.99.
I hope this helps!
jb30
44,806 PointsThe current value of drink
is the string "Blueberry + ' ' + Smoothie + ':$ ' + 4.99" instead of the string "Blueberry Smoothie: $4.99". The challenge is telling you that you need a space between the :
and the $
, and no space after the $
and before ${price}
.