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 solve this??

This are 2 codes of all the plenty solutions I have given this irritating task.. What does it want?

Convert the set of concatenated strings assigned to the drink variable to a template literal. The final string should be "Blueberry Smoothie: $4.99".

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

const drink = `´´${flavor} ${type}: $${price}´´.`



const flavor = "Blueberry";
const type = "Smoothie";
const price = 4.99;

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

Hi Marc! Try this answer

${flavor} ${type}: $ ${price}

Thanks for trying, didn´t solve it either though

Thank you so much. But why if i may ask. I`m coding my soultions in VS code, and it gives me no error when i don´t put the ; ? I thought it was optional?

Actually the semicolon ; is used to end the statement, so it's a good practice to use it always. Some programmers omit the semicolon, but you find when you are programming in other languages, such as Java or C# it's required. It's good to be consistent, otherwise you may run into errors in the future.

Okay I see. again thank you so much for your help. i will for sure not forget to put the ; after this challenge :)

I hope the answer worked for the challenge and you got it right this time. Good luck!

1 Answer

Don't forget the back ticks ${flavor} ${type}: $${price}; It worked for me.