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

how 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

app.js
const flavor = "Blueberry";
const type = "Smoothie";
const price = 4.99;

const drink = 

correct answer would be: const drink =${flavor} ${type}: $${price};

2 Answers

volhaka
volhaka
9,875 Points

when 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}`

Those 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!