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 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.

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>

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.