Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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 90,717 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 90,717 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;