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 JavaScript Basics (Retired) Introducing JavaScript Your First JavaScript Program

Shen Wq
Shen Wq
54 Points

js vs. html

In this exercise you write a simple string in js. I am wondering what advantage would there be to doing this in js compared to html.

When working with dynamic websites you need to generate dynamic data in your page continuously using Javascript for updating your site.At that time you need to use this type of methods to add content in your webpage with these type of methods.

1 Answer

Steven Parker
Steven Parker
231,271 Points

:point_right: This challenge is simply for scripting practice.

It's not meant to suggest this is necessarily the best way to achieve the result.

In fact, best practice would generally be to place content directly in the HTML, and use JavaScript to give the page functionality. And since this appears to be content, it would actually make sense to add it to the HTML.