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

I am a little perplexed with your decision to separate the logic of the program over two .js files

The decision to separate the task over two .js file struck me as quite a strange decision as it isn't something we have done throughout the course so far.

2 Answers

Owa Aquino
Owa Aquino
19,277 Points

Hi Lester,

The separation of codes in two files is to organised and make it much more user-friendly to the next programmer. It still will work the same as long as when you link your js files in the html is in correct order. If you're sure that you'll only be the one using the code you can make it on a one file.

Thank you for your reply. I understand the reasons it was done, I was just surprised that the teacher/lecturer's solution was presented in this way when previously he had not take this approach.