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 trialHelen Astill Steynor
3,848 PointsWhere is using HTML tags in a Javascript file introduced?
I'm doing the Practise Javascript Maths Methods video and Dave is again talking about using HTML tags in Javascript and I'm wondering if I've somehow missed a video introducing how to use HTML tags in Javascript. Does anyone know which video this is included in please? I've looked back over all the videos I've done so far in the Javascript Basics course and can't find anything anywhere.
Also, in this challenge he's mentioning using a linebreak tag - <br> - but again this has never been introduced to me in either the Javascript Basics, How to Make a Website or CSS Basics courses (I'm on the Front End Web Development track). I'm a complete novice when it comes to programming/scripting and felt like I was keeping up pretty well with everything so far, but I'm finding that the Javascript Basics course seems to be missing things out that should be included on a 'Basics course'.
Thank you in advance for any help/advice.
2 Answers
MIlton Tulli
15,884 PointsHi Helen!,
- I recommend that before taking the Practise Javascript Maths Methods course you should take at least the first part of the JavaScript Basics course ( https://teamtreehouse.com/library/javascript-basics course) to not overtake or confuse you. Frontend track is very gradual, and if you can follow it as it is patterned you will not have problems to understand. I recommend that before taking other courses you see the requirements well as they are well explained at the beginning.
- To understand how to manipulate the dom with javascript there is a very good course https://teamtreehouse.com/library/javascript-and-the-dom-2
- The <br> tag its a line break. Here some info https://www.w3schools.com/tags/tag_br.asp
Good luck!
andren
28,558 PointsDuring the "Practise Javascript Maths Methods" you are just meant to use HTML tags within strings, and then write those strings to the page using document.write
. You can't use HTML tags within JavaScript outside of strings, with the exception of JSX but that's a more complex topic which is not relevant to this challenge.
The document.write
method was demonstrated during the first couple of video of the Basic JavaScript course, and HTML tags were used during those demonstrations.
As for the <br> tag I'm somewhat surprised that was not shown off during the "How to Make a Website" course as it is a pretty basic HTML tag. But there are a lot of HTML tags so running into one you are unfamiliar with is not something that is going to be a rarity when doing web development. And usually a short Google search will bring up a pretty good explanation of what the tag does. The <br> tag for example simply creates an empty line, which is useful for spacing content.