Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript JavaScript Basics (Retired) Introducing JavaScript Link to an External Script

Supratim Nandi
Supratim Nandi
3,287 Points

problem understanding the question

I could not understand how to link a script file inside a body.when I know it has to be included inside head.

Jonathan Ankiewicz
Jonathan Ankiewicz
17,604 Points

You need to take the HTML and CSS classes before you actually get into Javascript. I noticed that Team treehouse doesn't require it with the full stack javascript developer.

1 Answer

Michael Fish
Michael Fish
7,804 Points

Hey Supratim,

You can place your script tag in either the head of the html file or at the very end of the body. Here is the html you need:

<script type="text/javascript" src="yourjavascriptfile.js"> </script>
Jonathan Ankiewicz
Jonathan Ankiewicz
17,604 Points

I would still recommend learning the html.

Michael Fish
Michael Fish
7,804 Points

Agreed. I learned HTML in a week. If you want to learn JavaScript quickly then just learn the HTML and go straight into JavaScript. I wasted months on CSS and while I do use it for positioning, sizing, and such I generally leave that to the designers.

My suggestion would be to do the How to Make a Website course with Nick Pettit. After that if you are in a hurry to add interactivity to your page or build web applications using Angular/Ember/React/Backbone then go straight to learning JavaScript. You can use Google and StackOverflow for CSS. The more time you devote to learning the syntax and structure of programming the better.

Constantly build things. Web apps, sites, whatever it is the most fun for you. Treehouse is great for learning the absolute basics but until you start building things you will never be job ready.