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 trialjiwan gurung
4,248 Points<body>is not a tag name?
i thought u can use body as a tag name just like we used<li> with the getElementbyTagName('li').
my code for the quiz 1 of 5 const body = document.getElementByTagName('body');
can someone help me what i am doing wrong
2 Answers
Olga DC
16,680 PointsHi Jiwan. First of all, when you select by tag, it is getElements in plural, and not getElement. Second, as the result of this selection will be an array of elements, -although it will only have one element because there is only one body element- you have to select the first item of the array with [0].
HIDAYATULLAH ARGHANDABI
21,058 Pointsbody tag belongs to html you can do the control work on javascript.. for printing you can use document.write. method