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

1 Answer

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 90,797 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.