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 Basic and Multiple Line Strings

What if I wanted to put another variable between the backticks that contained a string, would I have no choice but to...

use a + to insert the variable?

Joel Kraft
Joel Kraft
Treehouse Guest Teacher

Hi nathanielcusano,

Did Osama answer your question? Or do you still need help? If you still have questions, please provide a bit of code demonstrating your question, and I will try to help clarify.

Thanks, Joel

thanks Osama answered it

Joel Kraft
Joel Kraft
Treehouse Guest Teacher

Great! I changed his comment to an answer and marked it as accepted. Thanks!

2 Answers

you can do for Example: My name is ${your variable name} and i'm from ${your variable name}

Tom Geraghty
Tom Geraghty
24,174 Points

The answer wasn't explicit, but the MDN makes it clear that the syntax Osama used is required (including the dollar sign and curly braces).

From the MDN on Template Literals

`string text`

`string text line 1
 string text line 2`

`string text ${expression} string text`

tag `string text ${expression} string text`

And

Template literals can contain place holders. These are indicated by the Dollar sign and curly braces (${expression}).