JavaScript JavaScript Basics Hello, JavaScript! Add JavaScript to HTML

Dylan Carter
Dylan Carter
1,046 Points

Whats the point of having more than one linked JS file?

Couldn't you just have all your JS in one file? is this more of an organization thing for when coding gets more complex?

1 Answer

Steven Parker
Steven Parker
207,981 Points

In a large project, it often makes sense to break the code up into files with each one having a particular focus. You might also want separate files if each one comes from another party (such as a function library).

In smaller projects, just one JS file is usually fine.