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

shannon sivertsen
8,258 PointsCan someone help me understand this line of code?
token-${index}-${owner.id}
I'm not understanding what the -${} is doing.
Thanks!
2 Answers

Steven Parker
239,186 PointsAssuming that is enclosed in accents (`), it's a template string. Each identifier along with the braces and leading dollar sign will be replaced by the string representation of the value that the identifier contains. This process is called interpolation.
For example, if the variable "index" contains 3, and "owner.id" is "joe", then `token-${index}-${owner.id}
` would be interpolated into the string "token-3-joe".

shannon sivertsen
8,258 PointsThank you! Makes sense now!
shannon sivertsen
8,258 Pointsshannon sivertsen
8,258 Pointsah thanks! I wasn't sure if the dash was part of the code or part of the string. Makes more sense seeing the outcome. Thank you!