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

JavaScript

what is the purpose of Select the <main> HTML element? can we simply combine step 3 & 6 together

what is the purpose of Select the <main> HTML element? can we simply combine the code of step 3 & 6 together if it is solely for the purpose of displaying the result within the body element

Steven Parker
Steven Parker
231,153 Points

Can you provide a link to the course page you are working with? And if it's a video please also include a time.

2 Answers

Steven Parker
Steven Parker
231,153 Points

You're right, it's not necessary to select the main element any sooner than immediately before step 6. I'm not sure why the instructions put it as step 3 other than perhaps the instructor felt it was "cleaner" to establish it early in the program.

Thanks Steven. Sorry new to the forum, didn't realise the thread is out at the javascript forum.

https://teamtreehouse.com/library/the-conditional-challenge

confused in when to target/ select the element that needs to add content into (in that particular challenge it's only about step6 where content needs to be added into html, but is it necessary to select/target them ahead in step3?)