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 trialTSENG FUCHUN
4,287 PointsWhat is this syntax? I don't know about this...please help
What is the javascript ${username}
means?
And why these strings use the javascript `
mark?
const message = `${username} has ${badgeCount} total badge(s) and ${points} points in Javascript.`
Anyone could help?
1 Answer
Eric Butler
33,512 PointsHi Tseng, The back-ticks (those angled single-quote marks) indicate that this is a "template literal". It's a feature in ES6 that allows you to write multi-line strings and embed variables into the string like you see here. That's actually what the ${username}
is: it's how to embed the variable, username
, into the template literal string.