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 Hello, JavaScript! Add JavaScript to HTML

1 Answer

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,252 Points

Yes we can.

This is usually done in the footer of a page before the closing body tag. Like this...

    <script src="second-app.js" type="text/javascript"></script>
    <script src="app.js" type="text/javascript"></script>
<body>

In this example, there are 2 linking script files. I've used 2 app.js files as an example but you would have the main script file as the last one. Be aware that the files are read one by one by the browser so 2 functions of the same name in different files are overridden by the other.