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
Jason Frye
8,235 PointsHow did the playlist.js file use the printList function from the helpers.js file?
Can it "see" the function when I added the <script> tag for both files in index.html?
If I had multiple pages on a site and the JavaScript files were attached to separate pages of the same site, would it still be able to access a function from another file?
I am trying to determine where the link occurs. Thanks!
2 Answers
Steven Parker
243,160 PointsThe link occurs as the page is loaded by the browser. Only links on the current page are loaded and available, any that were loaded by other pages are disposed when a new page is loaded.
Of course, you can load the same script on more than one page.
Jason Frye
8,235 PointsThanks, Steven! That's exactly what I needed to know.
Steven Parker
243,160 PointsJason Frye — Glad to help. You can mark a question solved by choosing a "best answer".
Happy coding!