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 trialVic Mercier
3,276 PointsHow would I do to replace the string interpellation ${} method by its full name method?
How would I do to replace the string interpellation ${} method by its full name method?Because I want to avoid problem with the dollar sign.
Vic Mercier
3,276 Pointsconst name = "Victor" const named = ${name};
1 Answer
Steven Parker
231,269 PointsPlease explain the "problem with the dollar sign" — perhaps it is something that can be solved.
In the meantime, I'm not sure what the "full name method" is, but you can easily convert interpolation into concatenation. Here's an example:
console.log(`Hello, ${name}, and welcome to the ${place}!`); // interpolation
console.log("Hello, " + name + ", and welcome to the " + place + "!"); // concatenation
Vic Mercier
3,276 PointsI mean if you do with jQuery: $() it may be confused
Steven Parker
231,269 PointsOh, in open code, the $ stands for jQuery. But as Keith pointed out, in a string interpolation the $ is inside a pair of accents ("backticks") and will be handled differently. The system will not be confused.
Vic Mercier
3,276 PointsEven if your jQuery is put in a javasript file which has also the interpolation?
//Can you answer to my other questions
Steven Parker
231,269 PointsYes, particularly then. The $ in open code is jQuery, and the $ inside accents is interpolation. No confusion.
Keith Kelly
21,326 PointsKeith Kelly
21,326 PointsCan you show some code as an example? Are you using the ${} inside of a template literal? If so that will not cause a conflict with jquery since the $ is contained between the backticks of the template literal.