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 Combine Strings and Template Literals Review

B V K Mahijendra
B V K Mahijendra
9,133 Points

template literal

Quiz Question 2 of 6 Please fill in the correct answer in each blank provided below.

Fill in the blank(s) below:
Complete the code below to create a template literal:

const headline =-- <h1>A Literal Headline</h1>--;

5 Answers

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

this is not the right answer I have tried it in many ways and it doesn't work

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,252 Points

To make a template literal, you use the backtick characters... like this ` `.

let templateLiteral = `this is 
a template
literal
`;
B V K Mahijendra
B V K Mahijendra
9,133 Points

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

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

const drink = ${flavor} ${type}:$ ${price} ; ( this ain't working, could you help me with this? )

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,252 Points

Well, you've got the interpolation syntax just right. :)

You're missing the characters to actually make the template literal string.

Look carefully at what the example is saying. With these kinds of challenges, you have to get the string output just right as the code behind the scenes is looking for something specific! :-)

Good luck!

Back Ticks before and at end before;