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 trialPrath M
9,631 PointsWhich html tags can be defined in quotes for a variable?
If the following code can use h2 inside quotes, what other tags can be used inside quotes? Is it possible to put a div tag in there also? Any tags that cause a conflict?
var sentence = "<h2> There once was a " + adjective;
1 Answer
Justin Iezzi
18,199 PointsHi Pratham,
Any type of tag can be defined in a string, JavaScript is not aware this is an actual HTML tag. Only when it is written to the html document does the HTML interpret the tag as something meaningful. Using this technique, you can create some pretty powerful HTML generated content.
Let me know if you have any more questions!