JavaScript JavaScript Basics Working with Strings Write a Template Literal

russell pettus
PRO
russell pettus
Pro Student 452 Points

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

what is wrong

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

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

1 Answer

seth aruby
seth aruby
9,137 Points

Hey russell, When using template literals, you eliminate the need for concatenation and quotes. Also don't forget each variable requires the template literal syntax, like this:

const drink = `${flavor} ${type}: $${price}`;
rydavim
rydavim
Treehouse Moderator 18,083 Points

russell pettus - If seth aruby solved your question, consider marking his post as Best Answer. This encourages a helpful community, and let's other folks know that your post is resolved. Happy coding!