Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed JavaScript Basics!
You have completed JavaScript Basics!
Preview
JavaScript provides a more intuitive way to work with strings with a feature called "template literals." Template literals not only make your code more usable and readable, but they also enhance how you work with strings.
Code Snippet
const message = `Hello, ${name}. Welcome to my music site. I'm happy that you came by to visit, ${name}. Please come again and listen to more music!`;
Resources
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
into them with variables using
the addition or plus operator.
0:00
Alternating between single and
double quotes.
0:03
Concatenating variables with strings.
0:05
And creating multiline strings
might seem like a messy and
0:07
hard to read process for
dealing with strings.
0:10
You'll likely see similar techniques still
used in real life JavaScript code bases.
0:13
But JavaScript now provides a more
intuitive way to work with strings,
0:17
with a feature called template literals.
0:21
Template literals not only
make your code more usable and
0:23
readable, they also enhance all the ways
in which you can work with strings.
0:26
Let's see how they work.
0:29
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up