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 trialAbbas Rizvi
887 Pointshow to use $ for currency in template literal string
i was creating a string like this ${flavor} ${type}:$${price}
so is this correct flavor, type, price are variables
const flavor = "Blueberry";
const type = "Smoothie";
const price = 4.99;
const drink =
2 Answers
volhaka
9,875 Pointswhen I copy and paste your string as it is as a value for const drink I've got an error that there should be backtick(`) around string when I added backticks it says that there is should be a space after colon ':'
const drink = `${flavor} ${type}: $${price}`
Adam N
70,280 PointsThose are the correct varialbles. Your spacing doesn't seem to match what they're looking for, though - it has to be exact.
Let me know if this helps!
Joseph M.
2,057 PointsJoseph M.
2,057 Pointscorrect answer would be: const drink =
${flavor} ${type}: $${price}
;